I got a table like with 10 000 lines.
declare @a table
(
id bigint not null,
nm varchar(100) not null,
filter bigint
primary key (id)
)
A select, with 4-5 join, is taking x seconds. If a where clause is added, it's now taking 3x seconds. The where clause:
filter = @filder or
filter is null
I applied a nonclustered index on the column, but I'm getting only 10% on perfomance.
Any tips?
edit: the perfomance issue happens when the filter column is added. all joins are on primary keys.
SELECT filter FROM @a WHERE ........?? Should you be doing aSELECT *and thus having an index will most likely not help at all since the query optimizer will still scan the whole table (since you're asking for all the columns in your SELECT) ....