Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Other Technologies / Full-Text Search / February 2006

Tip: Looking for answers? Try searching our database.

a question or two re fulltext queries

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tbh - 07 Feb 2006 14:36 GMT
hi,

i'm using SQL Server 2000 (SP3, I think).

i am looking at SQL for finding documents (table DOC) based on a couple of
criteria, one of which involves a fulltext index on a related table (TXT).

i discovered today that a less selective CONTAINS() clause:
   CONTAINS (txt_stripped, 'daimler')
results in disastrous performance when I ask for the "top 10" documents
sorted by published date (a field of DOC) descending.

if I
1) include a more selective contains clause:
 CONTAINS (txt_stripped, 'daimler AND mercedes')
2) omit the "top 10" (there are only125 documents total.) or
3) omit the "ORDER BY  doc_pubfrom DESC" clause
the query performs fine.

i examined the query plans and discovered that in the bad case the first
thing done is to walk the doc_pubfrom index (figures, I guess: top 10 order
by...). in the other cases the first thing done is the "remote scan" of the
fulltext index, which is what I want done first.

i already know how I'll solve this problem: i don't need the "top 10" at
this point -- it was just a whim while prototyping.

my questions, though for future reference:
1) is there syntax to influence SQL's query planning specifically to prefer
the full text index ?
2) is there a way to get the query plan textually? (the graphic view is
great but I wondered what I would do if I wanted to mail it or post it)

cheers,

Tim Hanson
Hilary Cotter - 07 Feb 2006 15:00 GMT
1) Could you post the entire schema with indexes?

2) use set showplan_text on
Signature

Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com

> hi,
>
[quoted text clipped - 32 lines]
>
> Tim Hanson
tbh - 07 Feb 2006 15:34 GMT
thanks, Hillary, that was quick! :)

re 1) by "schema" you mean all affected tables? that would be a serious
handful. i'd hate to trouble you and post so much stuff. do you have any
general hints on keywords for nudging the query plan in favor of fulltext
index first?

re 2) thanks!!

cheers,

Tim

> 1) Could you post the entire schema with indexes?
>
> 2) use set showplan_text on
Hilary Cotter - 07 Feb 2006 17:39 GMT
Just the problem tables. I don't have any hints off the top of my head. You
might be able to do a force order query hint which might help.
Signature

Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com

> thanks, Hillary, that was quick! :)
>
[quoted text clipped - 12 lines]
>>
>> 2) use set showplan_text on
paulo.gonc@gmail.com - 08 Feb 2006 17:50 GMT
I have the same problem, when I search for a (litle) word that apears
in many records, the query that uses full-text index takes to long to
execute.
I use Top 1000, Contains() and Order By.
How can I optimize this without changing the TOP and Order by?
Thaks
Hilary Cotter - 09 Feb 2006 20:10 GMT
Can you use a containstable and the top_n_by_rank clause? IE

SELECT FT_TBL.Description,
  FT_TBL.CategoryName,
  KEY_TBL.RANK
FROM Categories AS FT_TBL INNER JOIN
  CONTAINSTABLE (Categories, Description,
     '("sweet and savory" NEAR sauces) OR
     ("sweet and savory" NEAR candies)'
     , 10
  ) AS KEY_TBL
  ON FT_TBL.CategoryID = KEY_TBL.[KEY]

Signature

Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com

>I have the same problem, when I search for a (litle) word that apears
> in many records, the query that uses full-text index takes to long to
> execute.
> I use Top 1000, Contains() and Order By.
> How can I optimize this without changing the TOP and Order by?
> Thaks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.