Execution plan surprise

Hi,

I have 2 tables: one with PK (+ Clustered index) on 3 columns and second with PK, FK on 3 columns (+ clustered index).

So I join those tables on 3 columns. I want to do some improvement and add 1 colum (of int type) to each table and create relation one-to-many. So now i may join on 1 column.... I have indexes on those new columns of course.

But I was surprissed but that join is slower ... On execution plan is showed that querry engine doesn't search newly added indexes, but old ones. And uses hash join (previously merge join).

Where is problem? Why sql server doesn't work on new indexes? Because they aren't clustered and not PK ?

Best regards,
Walter

[715 byte] By [WalterLuszczyk] at [2007-12-25]
# 1

Hi,

I just know ...

It was simply problem ... I quueried "SELECT * .....", so when I wrote * , the clustered index was searched - of course :) But when I specify explicite new columns in SELECT statement, everything goes I wanted.

Regards,
Walter

WalterLuszczyk at 2007-10-8 > top of Msdn Tech,SQL Server,SQL Server Database Engine...

SQL Server

Site Classified