Skip site navigation (1) Skip section navigation (2)

SeqScan with full text search

From: Tomek Walkuski <tomek(dot)walkuski(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: SeqScan with full text search
Date: 2012-04-16 14:02:13
Message-ID: 5afd048c-19e2-4a81-8439-bc09839d29dc@n5g2000vbf.googlegroups.com (view raw or flat)
Thread:
Lists: pgsql-performance
Hello group!

I have query like this:

SELECT
  employments.candidate_id AS candidate_id,
  SUM(TS_RANK(employers.search_vector, TO_TSQUERY('simple', 'One:* |
Two:* | Three:* | Four:*'), 2)) AS ts_rank
FROM
  employments
INNER JOIN
  employers ON employments.employer_id = employers.id
AND
  employers.search_vector @@ TO_TSQUERY('simple', 'One:* | Two:* |
Three:* | Four:*')
GROUP BY
  candidate_id;

And it results with this:

http://explain.depesz.com/s/jLM

The JOIN between employments and employers is the culprit. I'm unable
to get rid of the seq scan, and setting enable_seqscan to off makes
things even worse.

Is there any way to get rid of this JOIN?

What info should I post to debug this easier?

Thanks!

Responses

pgsql-performance by date

Next:From: Cesar MartinDate: 2012-04-16 14:13:42
Subject: Re: H800 + md1200 Performance problem
Previous:From: Florent GuillaumeDate: 2012-04-16 13:11:47
Subject: Re: Slow fulltext query plan

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group