Re: Forcing the right queryplan - Mailing list pgsql-general

From Tom Lane
Subject Re: Forcing the right queryplan
Date
Msg-id 29014.1284043852@sss.pgh.pa.us
Whole thread Raw
In response to Re: Forcing the right queryplan  (Henk van Lingen <H.G.K.vanLingen@uu.nl>)
Responses Re: Forcing the right queryplan  (Henk van Lingen <H.G.K.vanLingen@uu.nl>)
List pgsql-general
Henk van Lingen <H.G.K.vanLingen@uu.nl> writes:
>          ->  Bitmap Heap Scan on systemevents  (cost=61221.23..668806.93 rows=239805 width=158) (actual
time=9.131..1786.406rows=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

pgsql-general by date:

Previous
From: Henk van Lingen
Date:
Subject: Re: Forcing the right queryplan
Next
From: Chris Barnes
Date:
Subject: Re: logging postgres to syslog on centos, truncates the postgres message.