Re: Index Skip Scan - Mailing list pgsql-hackers

From Floris Van Nee
Subject Re: Index Skip Scan
Date
Msg-id 1561198638439.56867@Optiver.com
Whole thread Raw
In response to Re: Index Skip Scan  (Jesper Pedersen <jesper.pedersen@redhat.com>)
Responses Re: Index Skip Scan
List pgsql-hackers
The following sql statement seems to have incorrect results - some logic in the backwards scan is currently not
entirelyright. 

-Floris


drop table if exists a;
create table a (a int, b int, c int);
insert into a (select vs, ks, 10 from generate_series(1,5) vs, generate_series(1, 10000) ks);
create index on a (a,b);
analyze a;
select distinct on (a) a,b from a order by a desc, b desc;
explain select distinct on (a) a,b from a order by a desc, b desc;

DROP TABLE
CREATE TABLE
INSERT 0 50000
CREATE INDEX
ANALYZE
 a |   b
---+-------
 5 | 10000
 5 |     1
 4 |     1
 3 |     1
 2 |     1
 1 |     1
(6 rows)

                                   QUERY PLAN
---------------------------------------------------------------------------------
 Index Only Scan Backward using a_a_b_idx on a  (cost=0.29..1.45 rows=5 width=8)
   Scan mode: Skip scan
(2 rows)




pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: \describe*
Next
From: Tomas Vondra
Date:
Subject: Re: Choosing values for multivariate MCV lists