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

Re: SeqScan with full text search

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tomek Walkuski <tomek(dot)walkuski(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: SeqScan with full text search
Date: 2012-04-16 19:38:10
Message-ID: CAHyXU0xr_w-zXNVwtipH4m9Nx_FGAxaNz424gGCh8chVhR=cJA@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-performance
On Mon, Apr 16, 2012 at 9:02 AM, Tomek Walkuski
<tomek(dot)walkuski(at)gmail(dot)com> wrote:
> 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?

get rid of the join?  the seq scan is natural since it seems like
you're querying the whole table, right?  maybe if you explained the
problem in more detail (especially why you think the seq scan might
not be required)?

merlin

In response to

pgsql-performance by date

Next:From: Istvan EndredyDate: 2012-04-17 09:49:57
Subject: Re: bad planning with 75% effective_cache_size
Previous:From: Scott MarloweDate: 2012-04-16 17:47:52
Subject: Re: H800 + md1200 Performance problem

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