A
A
Andrey Ovsyankin2014-03-14 16:21:41
SQL
Andrey Ovsyankin, 2014-03-14 16:21:41

Which query plan is better?

There is a query that selects approximately 100k rows.
He had such an execution plan
habrastorage.org/files/ac3/889/550/ac38895507ef4d0...
It shows 2 table scans, this is a condition like:
LEFT JOIN table ON table.somefield = @param
I added an index on this field somefield, and the plan became like this:
habrastorage.org /files/0a1/2be/863/0a12be86308c45d...
The execution time hasn't really changed. Is it possible to say which of these plans is obviously worse?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton Belichkov, 2014-05-24
@za90

It's hard to say without knowing the details, however... No, I don't like any of them!
Try hard hints to turn off the brains of the server. Sometimes option (loop join, force order) helps better than creating indexes. Well, in join, kick table with (index (TMPIND_0)) or whatever it is.

F
Fadmin, 2014-06-03
@Fadmin

You would though show request, and it is better with the data.
table scan and hash match indicate that something else can be done,
the question is whether it is necessary?
Works very slowly?
Is the index clustered? Covering your join?

E
Edward, 2014-07-25
@edb

use set statistics io, time onto understand what really slows down

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question