From: Bruno Wolff III <bruno@wolff.to>
To: Bernd Heller <bdheller@users.sourceforge.net>
Cc: pgsql-performance@postgresql.org
Subject: Re: column without pg_stats entry?!
Date: Thu, 20 Jan 2005 18:26:20 -0600
Message-ID: <20050121002620.GB16417@wolff.to> (raw)
In-Reply-To: <11D72EC4-6ACC-11D9-A12E-000A957B8C6E@users.sourceforge.net>
References: <11D72EC4-6ACC-11D9-A12E-000A957B8C6E@users.sourceforge.net>
On Thu, Jan 20, 2005 at 11:14:28 +0100,
Bernd Heller <bdheller@users.sourceforge.net> wrote:
>
> I wondered why the planner was making such bad assumptions about the
> number of rows to find and had a look at pg_stats. and there was the
> surprise:
> there is no entry in pg_stats for that column at all!! I can only
> suspect that this has to do with the column being all null. I tried to
> change a few records to a not-null value, but re-ANALYZE didn't catch
> them apparently.
Someone else reported this recently and I think it is going to be fixed.
> Is this desired behaviour for analyze? Can I change it somehow? If not,
> is there a better way to accomplish what I'm trying? I'm not to keen on
> disabling seqscan for that query explicitly. It's a simple enough query
> and the planner should be able to find the right plan without help -
> and I'm sure it would if it had stats about it.
In the short run you could add an IS NOT NULL clause to your query.
The optimizer doesn't know that < being TRUE implies IS NOT NULL and
so the partial index won't be used unless you add that clause explicitly.
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: bruno@wolff.to, bdheller@users.sourceforge.net
Subject: Re: column without pg_stats entry?!
In-Reply-To: <20050121002620.GB16417@wolff.to>
* 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