From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tim Uckun <timuckun@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Problems with adding a is not null to a query.
Date: Sat, 15 Jan 2011 10:45:03 -0500
Message-ID: <28545.1295106303@sss.pgh.pa.us> (raw)
In-Reply-To: <AANLkTi=1DVjv6XdGSZ8H_LGvKdLBME4Gp15O0xnWv_8M@mail.gmail.com>
References: <AANLkTi=1DVjv6XdGSZ8H_LGvKdLBME4Gp15O0xnWv_8M@mail.gmail.com>
Tim Uckun <timuckun@gmail.com> writes:
> I reported this in the pgsql-general list and was instructed to send
> the analaze outputs here.
This isn't a bug, it's just a poor choice of plan based on a bad
statistical estimate. The planner is estimating that there are 2643
rows having domain_id = 157, when actually there are none whatsoever,
as can be seen here:
> " -> Bitmap Index Scan on
> index_topical_urls_on_domain_id_and_consolidated_url_id
> (cost=0.00..104.63 rows=2643 width=0) (actual time=44.629..44.629
> rows=0 loops=1)"
> " Index Cond: (domain_id = 157)"
Possibly the table's never been ANALYZEd ... do you have autovacuum
enabled? If it has been analyzed reasonably recently, then it might be
necessary to crank up the statistics target to get a better estimate.
It's difficult to give detailed advice when you haven't mentioned what
PG version you're running.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, timuckun@gmail.com
Subject: Re: Problems with adding a is not null to a query.
In-Reply-To: <28545.1295106303@sss.pgh.pa.us>
References: <AANLkTi=1DVjv6XdGSZ8H_LGvKdLBME4Gp15O0xnWv_8M@mail.gmail.com> <28545.1295106303@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox