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 15:16:36
Message-ID: 29669.1284045396@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:
> On Thu, Sep 09, 2010 at 10:50:52AM -0400, Tom Lane wrote:
>>>> 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.

> But how can I get sane estimates for syslog data? Some searchstrings will
> result in only a few hits, others in thousands of records or more.

That's what ANALYZE is for ...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ungermann Carsten 2010-09-09 15:36:38 Re: Regular expression in an if-statement will not work
Previous Message Henk van Lingen 2010-09-09 15:04:17 Re: Forcing the right queryplan

Browse pgsql-novice by date

  From Date Subject
Next Message Rob Richardson 2010-09-09 15:43:15 Query help, please
Previous Message Henk van Lingen 2010-09-09 15:04:17 Re: Forcing the right queryplan