Performance issue with CONTAINS
- From: "boblotz2001" <boblotz2001@xxxxxxxxx>
- Date: 5 Sep 2006 13:02:04 -0700
Seemingly a simple thing but something is wrong:
SELECT * FROM PERSON WHERE company_id = 7410 AND CONTAINS(first_name,
'Daniel') takes 2.5 minutes.
SELECT person.* FROM CONTAINSTABLE(PERSON, first_name, 'Daniel') AS a
JOIN person ON a.key = person.person_id WHERE company_id = 7410 takes
under a second.
Person table has 1101665 Million rows. 3893 rows have company_id =
7410. 6836 rows contain 'Daniel'. Total of 32 rows are returned.
Catalog attributes:
Item Count: 1101665
Unique Key Count: 4271510
Catalog Size: 128 Mb
The second query runs as expected: person table performs an index seek
on the company_id index and returns 3893 rows, remote scan returns 6836
rows and a Hash Match join is used to produce 32 rows.
The second query starts the same by using the company_id index and
returning 3893 rows but then things get ugly. Remote scan show
estimated number of rows as 6836 but returns 26,510,733 rows and a
filter is then applied to filter the number of rows to 32! Needless to
say that takes a while.
Need to add the fact that the catalog contains one table 'PERSON' but
there are about
dozen columns in PERSON table being indexed.
Any thoughts?
Thanks
.
- Follow-Ups:
- Re: Performance issue with CONTAINS
- From: Hilary Cotter
- Re: Performance issue with CONTAINS
- Prev by Date: Re: Strange behavior of CONTAINS function
- Next by Date: Re: Strange behavior of CONTAINS function
- Previous by thread: Re: newbie: containstable query structure
- Next by thread: Re: Performance issue with CONTAINS
- Index(es):
Relevant Pages
|
Loading