Re: Forcing the right queryplan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Henk van Lingen <H(dot)G(dot)K(dot)vanLingen(at)uu(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Forcing the right queryplan
Date: 2010-09-09 14:50:52
Message-ID: 29014.1284043852@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

Henk van Lingen <H(dot)G(dot)K(dot)vanLingen(at)uu(dot)nl> writes:
> -> Bitmap Heap Scan on systemevents (cost=61221.23..668806.93 rows=239805 width=158) (actual time=9.131..1786.406 rows=464 loops=1)
> Recheck Cond: (to_tsvector('english'::regconfig, message) @@ to_tsquery('131.211.112.9'::text))

Well, there's your problem: the planner is off by a factor of about 500
on its estimate of the number of rows matching this query, and that's
what's causing it to pick the wrong plan. What you need to look into
is getting that estimate to be more in sync with reality. Probably
increasing the stats target for the message column would help.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Barnes 2010-09-09 14:52:58 Re: logging postgres to syslog on centos, truncates the postgres message.
Previous Message Henk van Lingen 2010-09-09 14:40:02 Re: Forcing the right queryplan

Browse pgsql-novice by date

  From Date Subject
Next Message Henk van Lingen 2010-09-09 15:04:17 Re: Forcing the right queryplan
Previous Message Henk van Lingen 2010-09-09 14:40:02 Re: Forcing the right queryplan