From: | Floris Van Nee <florisvannee(at)Optiver(dot)com> |
---|---|
To: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, James Coleman <jtc331(at)gmail(dot)com>, "jesper(dot)pedersen(at)redhat(dot)com" <jesper(dot)pedersen(at)redhat(dot)com> |
Cc: | Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, "Peter Geoghegan" <pg(at)bowt(dot)ie>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, "Thomas Munro" <thomas(dot)munro(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru> |
Subject: | Re: Index Skip Scan |
Date: | 2019-06-22 10:17:04 |
Message-ID: | 1561198638439.56867@Optiver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
The following sql statement seems to have incorrect results - some logic in the backwards scan is currently not entirely right.
-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)
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2019-06-22 14:10:52 | Re: Choosing values for multivariate MCV lists |
Previous Message | David Fetter | 2019-06-21 23:53:53 | Re: \describe* |