Bart,
> insert into foo (baz) values (28);
> create index foo_idx on foo(baz);
> vacuum full analyze foo;
>
> Now, we would expect that PostgreSQL is fully aware that there are not
> many rows in foo that have "baz is not null". However:
This is a known issue discussed several times on this list. Try re-creating
your index as:
create index foo_idx on foo(baz) where foo is not null;
See the list archives for the reasons why. This may improve in future
releases of PostgreSQL.
--
Josh Berkus
Aglio Database Solutions
San Francisco