Re: Query Performance

Tech-Archive recommends: Fix windows errors by optimizing your registry



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


.



Relevant Pages

  • Re: I have no idea why this isnt working - must be missing something simple
    ... "Thomas Matthews" wrote... ... >> This while loop keeps repeating even when a correct character is ... complain about comparing a char to a pointer. ... as long as the user always enters ONE character. ...
    (comp.lang.cpp)
  • Re: using char in do while condition
    ... my fever is taking over me ... evaluates the expression as type "char" which is not a valid type for the ... by comparing the character as a range instead ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: DMG II
    ... laser and my characters dino laser resistant vest your character can no ... Still comparing fruit and meat. ... since offensive and defensive *equipment* can also exist in the ...
    (rec.games.frp.gurps)
  • Re: Why does this not work?
    ... Since you're converting your dates to character strings and then comparing ... SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: first different character in string
    ... boundary and start reading and comparing 4 bytes at a time. ... When a mismatch ... if I had the strings ... > characters in the character array, but I was wondering if there was some ...
    (microsoft.public.dotnet.languages.csharp)