0

I have a query like:

select * from tableA where id in (1,2,3,..)

List of ids ids very long about 200 000 ids.
There is an clustered index on id colums.
The same query on mysql rus fast but on MS it cant take about 20 minuts (on mysql takes few second).
How can I resolve this?

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by rch1231
0

Well my first suggestion would be to run mysql on windows instead of MS SQLServer. But barring that is the field indexed in MS SQL server?

0

Well my first suggestion would be to run mysql on windows instead of MS SQLServer. But barring that is the field indexed in MS SQL server?

It's not mine decsion to use MS SQL. There is a proper index on id (execution plan show that index was used), I noticed that query runs fast when MS use nested loops to search (up to several thousand of ids) but when there is about 100 000 ids MS use hash match and its very slow.

0

Is it possible to set up a separate table with the ID's or to flag the records in the database somehow. You have to get the list from somewhere so why not set up a table with the ID's and do a join off of the ID.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.