Re: Query Performance
- From: "David Botzenhart" <David.Botzenhart.NoSpam@xxxxxxxxxxxxxxx>
- Date: Fri, 29 Apr 2005 14:25:33 -0400
Hi Ash,
I would say the first sinario would be better, since you are comparing
numeric values in the Identitiy field this eliminates one of the character
comparisons that SQL would have to do.
David Botzenhart
"Ash" <Ash@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:35B4DB69-229F-41F4-8232-339934FDC681@xxxxxxxxxxxxxxxx
> So which scenario would the join run faster (I'm talking about > 2,000,000
> records in each table)
>
> 1)ID is PK, F1 & F2 are unique and index
> table1 table2
> ID <IDENTITY> ID<IDENTIT>
> F1<CHAR(10)> F1<CHAR(10)>
> F2<CHAR(10)> F2<CHAR(10)>
> F3<CHAR(10)> F4<CHAR(10)>
> SELECT * FROM table1 t1,table2 t2 WHERE t1.ID=t2.ID AND t1.f1='Somthing'
AND
> t1.f2='Somthing Else'
>
> 2)F1 & F2 are PK and index
> table1 table2
> F1<CHAR(10)> F1<CHAR(10)>
> F2<CHAR(10)> F2<CHAR(10)>
> F3<CHAR(10)> F4<CHAR(10)>
> SELECT * FROM table1 t1,table2 t2 WHERE t1.f1=t2.f1 AND t1.f2=t2.f2 AND
> t1.f1='Somthing' AND t1.f2='Somthing Else'
>
> Thanks
.
- References:
- Query Performance
- From: Ash
- Query Performance
- Prev by Date: Delphi and OLAP
- Next by Date: Re: an error when import a txt file
- Previous by thread: Re: Query Performance
- Next by thread: Delphi and OLAP
- Index(es):
Relevant Pages
|