full text search - SQL Server: Seperate queries return in less than a second but combining those with INTERSECT takes 3 mins -


i'm not sure if sql server bug or mistake here situation:

query 1

select pk pi_inform record_date>dateadd(hour,-48, getdate()) 

this takes less 0.5 secs , returns 20,000 records

query 2

select pk dbo.getinformfulltextpks('"hello"') 

this takes less 1 secs , returns 500 records

problem if join 2 queries intersect, takes more 3 minutes. execution plans shows performed using index seek.

select * pi_inform (nolock) pk in ( select pk pi_inform record_date>dateadd(hour,-48, getdate()) intersect select pk pi_inform pk in (select pk dbo.getinformfulltextpks('"hello"')) ) 

the following query equivalent , should run faster

select * pi_inform (nolock) pk in (select pk dbo.getinformfulltextpks('"hello"')) , record_date>dateadd(hour,-48, getdate()) 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -