Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is There a Quick Way to Get a Total Match Count (estimate is OK) of a SQL FullText Query?

9 views
Skip to first unread message

Wenbin Zhang

unread,
Aug 13, 2005, 11:02:11 AM8/13/05
to
Hi,

I am using the June CTP release of SQL Server 2005 on Windows Sever 2003.

Is there a quick way to get a total natch count (estimate is OK)
of a SQL FullText query? I am working with about 10 million r
ows of simple character data.

The following SQL simply returns too slow due to disk IO on the disk
with the relational table when the number of hits is large (say half
millions)

select count(*) from CONTAINSTABLE(MyTableName, FTColumnName, '
"QueryPhrase" ')

Thanks,
Wenbin Zhang


John Kane

unread,
Aug 15, 2005, 2:17:54 AM8/15/05
to
Wenbin Zhang,
Since you're using SQL Server 2005, the best way to get this type of
statistical info is from the word list in the FT Catalog via the CIDump.exe
utility (see related thread subject: cidump documentation?) and import the
output back into a SQL Server table.

If you need to use a T-SQL to determine the word count of a SQL FTS query,
instead of just using a count(*), it is faster to use a stored proc, for
example:

create proc FTS_t1 (@SearchWord varchar(7800))
as
select c1 from t1 where contains(c2, @SearchWord)
go
create proc FTSCount_t1 (@SearchWord varchar(7800))
as
set nocount on
create table #FTPrimaryKey(t1_UPK int)
insert into #FTPrimaryKey exec FTS_t1 @SearchWord
select count(*) from #FTPrimaryKey
set nocount off
go
-- example of use:
exec FTSCount_t1 '"computer"'

Hope that helps!
John
--
SQL Full Text Search Blog
http://spaces.msn.com/members/jtkane/

"Wenbin Zhang" <zhang_...@hotmail.com> wrote in message
news:%23arzmzV...@TK2MSFTNGP10.phx.gbl...

Baz

unread,
Apr 20, 2010, 11:58:18 PM4/20/10
to
It's fun answering a 5 year-old post, but just in case: why would it be faster to do more in a stored proc?

From http://www.developmentnow.com/g/104_2005_8_0_0_579691/Is-There-a-Quick-Way-to-Get-a-Total-Match-Count-estimate-is-OK-of-a-SQL-FullText-Query.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com/g/

0 new messages