From: | Ruslan A Dautkhanov <rusland(at)scn(dot)ru> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | conditional indexes |
Date: | 2003-06-25 09:33:27 |
Message-ID: | 3EF96C67.6050204@scn.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hello,
I think that conditional indexes not so clever as can.. Just little one
example:
isbs=# create unique index person_login on person (login) where
login<>'';
CREATE INDEX
isbs=# explain select * from person where login='user';
QUERY PLAN
---------------------------------------------------------
Seq Scan on person (cost=0.00..53.34 rows=1 width=167)
Why it does not use person_login index - predicate login='user' definitely
also mean (login<>'') - indexes' predicate!
isbs=# explain select * from person where login='user' and login<>'';
QUERY PLAN
-----------------------------------------------------------------------------
Index Scan using person_login on person (cost=0.00..5.97 rows=1
width=167)
Postgres start to use conditional index only when I also pass index'
condition:
login='user' AND login<>'' ...
isbs=# select version();
version
---------------------------------------------------------------------
PostgreSQL 7.3.3 on i386-unknown-freebsd4.7, compiled by GCC 2.95.4
--
best regards,
Ruslan A Dautkhanov rusland(at)scn(dot)ru
From | Date | Subject | |
---|---|---|---|
Next Message | Hubert Lubaczewski | 2003-06-25 09:50:30 | Re: conditional indexes |
Previous Message | Bruce Momjian | 2003-06-25 01:09:31 | Re: bug in pg.py and the fix |