Re: [PERFORM] not using partial index

2011-04-23 Thread Henry
Willy-Bas Loos wrote: >Hi, > >I'm using PostgreSQL 8.4 (and also 8.3). > >A partial index like this: >CREATE INDEX table2_field1_idx > ON table2 (field1) > WHERE NOT field1 ISNULL; > >Will not be used when select one record from 100K records: > >explain select * from table2 where field1 = 2569

Re: [PERFORM] not using partial index

2011-04-20 Thread Tom Lane
Willy-Bas Loos writes: > [ NOT field1 ISNULL is not seen as equivalent to field1 IS NOT NULL ] > Any ideas why this might be? The planner does not spend an infinite number of cycles on trying to make different expressions look alike. As it happens, 9.1 does know this equivalence, as a byproduct

[PERFORM] not using partial index

2011-04-20 Thread Willy-Bas Loos
Hi, I'm using PostgreSQL 8.4 (and also 8.3). A partial index like this: CREATE INDEX table2_field1_idx ON table2 (field1) WHERE NOT field1 ISNULL; Will not be used when select one record from 100K records: explain select * from table2 where field1 = 256988 'Seq Scan on table2 (cost=0.00..16