Re: [PERFORM] Using index for IS NULL query

2008-11-12 Thread Tomas Vondra
Well, you're obviously right - I didn't know this. I guess I've found that the index is not used for null values, and deduced somehow that NULL values are not stored in the index. Thanks, it's nice to find out a 'bug' before it's too late :-) regards Tomas Are you sure NULL values are not sto

Re: [PERFORM] Using index for IS NULL query

2008-11-12 Thread Matthew Wakeling
On Tue, 11 Nov 2008, Tom Lane wrote: Index is not used for is null How to fix ? Update to something newer than 8.1 (specifically, you'll need 8.3). Oooh, that's useful to know. We can get rid of all our extra nulls indexes. Thanks. Matthew -- As you approach the airport, you see a sign s

Re: [PERFORM] Using index for IS NULL query

2008-11-11 Thread Scott Marlowe
On Tue, Nov 11, 2008 at 4:00 PM, Vladimir Sitnikov <[EMAIL PROTECTED]> wrote: > >> Yes, NULL values are not stored in the index, but you may create >> functional index on > > Are you sure NULL values are not stored? btree, gist and bitmap index and > search for NULL values. It's not that they're n

Re: [PERFORM] Using index for IS NULL query

2008-11-11 Thread Vladimir Sitnikov
> Yes, NULL values are not stored in the index, but you may create functional > index on > Are you sure NULL values are not stored? btree, gist and bitmap index and search for NULL values. select amname, amindexnulls, amsearchnulls from pg_am; amname | amindexnulls | amsearchnulls +-

Re: [PERFORM] Using index for IS NULL query

2008-11-11 Thread Tomas Vondra
Index is not used for is null condition: create index makse_dokumnr_idx on makse(dokumnr); explain select sum( summa) from MAKSE where dokumnr is null "Aggregate (cost=131927.95..131927.96 rows=1 width=10)" " -> Seq Scan on makse (cost=0.00..131927.94 rows=1 width=10)" "F

Re: [PERFORM] Using index for IS NULL query

2008-11-11 Thread Andreas Kretschmer
Tom Lane <[EMAIL PROTECTED]> schrieb: > "Andrus" <[EMAIL PROTECTED]> writes: > > Index is not used for > > is null > > > How to fix ? > > Update to something newer than 8.1 (specifically, you'll need 8.3). Right. For my example in the other mail: test=*# create index idx_foo on foo(i); CREATE

Re: [PERFORM] Using index for IS NULL query

2008-11-11 Thread Andreas Kretschmer
Andrus <[EMAIL PROTECTED]> schrieb: > Index is not used for > > is null > > condition: > > create index makse_dokumnr_idx on makse(dokumnr); > explain select > sum( summa) > from MAKSE > where dokumnr is null > > "Aggregate (cost=131927.95..131927.96 rows=1 width=10)" > " -> Seq Scan

Re: [PERFORM] Using index for IS NULL query

2008-11-11 Thread Tom Lane
"Andrus" <[EMAIL PROTECTED]> writes: > Index is not used for > is null > How to fix ? Update to something newer than 8.1 (specifically, you'll need 8.3). regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to

[PERFORM] Using index for IS NULL query

2008-11-11 Thread Andrus
Index is not used for is null condition: create index makse_dokumnr_idx on makse(dokumnr); explain select sum( summa) from MAKSE where dokumnr is null "Aggregate (cost=131927.95..131927.96 rows=1 width=10)" " -> Seq Scan on makse (cost=0.00..131927.94 rows=1 width=10)" "F