>> >> Hello, >> >> In the newest PostgreSQL(9.1.1) or lower, Index-Scan's actual time may >> increase unexpectedly. >> >> I think that this is for scanning All NULL VALUES when performing an >> indexscan >> even if they does not need to be scanned. > >I think this was just fixed. Please check latest source code.
I have checked latest source code. But, backward scan doesn't work correctly... ========================================== [naoya@nesitcspg03 ~]$ psql psql (9.2devel) Type "help" for help. naoya=# create table hoge(id integer,id2 integer); CREATE TABLE naoya=# insert into hoge select generate_series(1,10); INSERT 0 10 naoya=# update hoge set id2=1 where id=5; UPDATE 1 naoya=# update hoge set id2=10 where id=7; UPDATE 1 naoya=# create index hoge_idx on hoge(id2); CREATE INDEX naoya=# analyze hoge; ANALYZE naoya=# set enable_bitmapscan to off; SET naoya=# set enable_seqscan to off; SET naoya=# select * from hoge; id | id2 ----+----- 1 | 2 | 3 | 4 | 6 | 8 | 9 | 10 | 5 | 1 7 | 10 (10 rows) naoya=# explain analyze select * from hoge where id2>0; QUERY PLAN --------------------------------------------------------------------------------------------------------------- Index Scan using hoge_idx on hoge (cost=0.00..8.29 rows=2 width=8) (actual time=0.010..0.012 rows=2 loops=1) Index Cond: (id2 > 0) Total runtime: 0.065 ms (3 rows) naoya=# explain analyze select * from hoge where id2>0 order by id2 desc; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ Index Scan Backward using hoge_idx on hoge (cost=0.00..8.29 rows=2 width=8) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: (id2 > 0) Total runtime: 0.035 ms (3 rows) naoya=# select * from hoge where id2>0; id | id2 ----+----- 5 | 1 7 | 10 (2 rows) naoya=# select * from hoge where id2>0 order by id2 desc; id | id2 ----+----- (0 rows) ========================================== Regards. --- Naoya Anzai --- -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs