RE: Index Skip Scan (new UniqueKeys) - Mailing list pgsql-hackers

From Floris Van Nee
Subject RE: Index Skip Scan (new UniqueKeys)
Date
Msg-id fb18ee881ea24d31b5272b4e5053a6aa@opammb0561.comp.optiver.com
Whole thread Raw
In response to Re: Index Skip Scan (new UniqueKeys)  (Dmitry Dolgov <9erthalion6@gmail.com>)
Responses Re: Index Skip Scan (new UniqueKeys)  (Dmitry Dolgov <9erthalion6@gmail.com>)
List pgsql-hackers
Hi Dmitry,

Also took another look at the patch now, and found a case of incorrect data. It looks related to the new way of
creatingthe paths, as I can't recall seeing this in earlier versions. 

create table t1 as select a,b,b%5 as c, random() as d from generate_series(1, 10) a, generate_series(1,100) b;
create index on t1 (a,b,c);

postgres=# explain select distinct on (a) * from t1 order by a,b desc,c;
                                  QUERY PLAN
-------------------------------------------------------------------------------
 Sort  (cost=2.92..2.94 rows=10 width=20)
   Sort Key: a, b DESC, c
   ->  Index Scan using t1_a_b_c_idx on t1  (cost=0.28..2.75 rows=10 width=20)
         Skip scan: true
(4 rows)


With the 'order by a, b desc, c' we expect the value of column 'b' to always be 100. With index_skipscan enabled, it
alwaysgives 1 though. It's not correct that the planner chooses a skip scan followed by sort in this case. 

-Floris




pgsql-hackers by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: expose parallel leader in CSV and log_line_prefix
Next
From: Mark Dilger
Date:
Subject: Re: factorial function/phase out postfix operators?