Sql-server – SQL Server full text search query takes way too long to execute

full-text-searchsql serversql server 2014sql-server-2012

I've got query snippet as follows:

SELECT *
FROM CONTAINSTABLE(dbo.Analysis, *, 'FORMSOF(FREETEXT, "historic year-on-year exchange rates forecast year-on-year exchange rates")');

I'm running it on SQL Server 2014.

However it executes forever, so I just give up and cancel it.

  • If I remove words year-on-year it works just fine.
  • FTCatalog was rebuilt – didn't help.

This has been driving me crazy for a while now.
I dont't have a lot of experience with FTS searches, but this just doesn't make any sense.

Please advice how to make it work or where I should start looking at.

Best Answer

In place of your query, try this:

SELECT * FROM dbo.Analysis 
where FREETEXT(dbo.Analysis, 'historic year-on-year exchange rates forecast
yearon-year exchange rates');

or this:

SELECT * FROM  dbo.Analysis 
where CONTAINS(dbo.Analysis, "historic year-on-year exchange rates forecast
year-on-year exchange rates");

Also, the hyphens may be causing problems. Try:

year on year

or

yearonyear

in place of the hyphens.

Lastly, did you build and enable a stop list?