From: Floris Van Nee <florisvannee@Optiver.com>
To: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: jesper.pedersen@redhat.com <jesper.pedersen@redhat.com>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: James Coleman <jtc331@gmail.com>
Cc: Rafia Sabih <rafia.pghackers@gmail.com>
Cc: Jeff Janes <jeff.janes@gmail.com>
Cc: Peter Geoghegan <pg@bowt.ie>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Bhushan Uparkar <bhushan.uparkar@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>
Subject: Re: Index Skip Scan
Date: Wed, 28 Aug 2019 19:31:51 +0000
Message-ID: <1567020711705.41641@Optiver.com> (raw)
In-Reply-To: <CA+q6zcWhxVMv6aGOv+f+3b=4qQ=0Mhqk6pojT6p_BEsCtG9P-g@mail.gmail.com>
References: <1d917274-73c1-24de-9faf-c1d2c542cb23@redhat.com>
<CA+q6zcXgwDMiowOGbr7gimTY3NV-LbcwP=rbma_L56pc+9p1Xw@mail.gmail.com>
<20190725.201737.192223037.horikyota.ntt@gmail.com>
<20190725.202950.257050501.horikyota.ntt@gmail.com>
<CA+q6zcWC_TLO8fj_ad4pADLpr7UFjzRfXcMJ8gQsWtvT1Ky+9w@mail.gmail.com>
<CA+q6zcX0T3jhR=phrNxrT-iyMceJ3tLJimARmWFU8s8f_iK7Ew@mail.gmail.com>
<f623b9d7-05bf-8903-5388-1fff5022860d@redhat.com>
<1564999539204.96859@Optiver.com>
<CA+q6zcWAKuwSGXh2mGJpeZ1d2Fu+Av13UYvFScs9mMcCCcrBPg@mail.gmail.com>
<1565080675672.86115@Optiver.com>
<CA+q6zcWhxVMv6aGOv+f+3b=4qQ=0Mhqk6pojT6p_BEsCtG9P-g@mail.gmail.com>
> Sorry for long delay. Here is more or less what I had in mind. After changing
> read_closest to read the whole page I couldn't resist to just merge it into
> readpage itself, since it's basically the same. It could raise questions about>
> performance and how intrusive this patch is, but I hope it's not that much of a
> problem (in the worst case we can split it back). I've also added few tests for
> the issue you've mentioned. Thanks again, I'm appreciate how much efforts you
> put into reviewing!
Putting it into one function makes sense I think. Looking at the patch, I think in general there are some good improvements in there.
I'm afraid I did manage to find another incorrect query result though, having to do with the keepPrev part and skipping to the first tuple on an index page:
postgres=# drop table if exists b; create table b as select a,b::int2 b,(b%2)::int2 c from generate_series(1,5) a, generate_series(1,366) b; create index on b (a,b,c); analyze b;
DROP TABLE
SELECT 1830
CREATE INDEX
ANALYZE
postgres=# set enable_indexskipscan=1;
SET
postgres=# select distinct on (a) a,b,c from b where b>=1 and c=0 order by a,b;
a | b | c
---+---+---
1 | 2 | 0
2 | 4 | 0
3 | 4 | 0
4 | 4 | 0
5 | 4 | 0
(5 rows)
postgres=# set enable_indexskipscan=0;
SET
postgres=# select distinct on (a) a,b,c from b where b>=1 and c=0 order by a,b;
a | b | c
---+---+---
1 | 2 | 0
2 | 2 | 0
3 | 2 | 0
4 | 2 | 0
5 | 2 | 0
(5 rows)
-Floris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: florisvannee@Optiver.com, 9erthalion6@gmail.com, horikyota.ntt@gmail.com, jesper.pedersen@redhat.com, david.rowley@2ndquadrant.com, thomas.munro@gmail.com, jtc331@gmail.com, rafia.pghackers@gmail.com, jeff.janes@gmail.com, pg@bowt.ie, tomas.vondra@2ndquadrant.com, thomas.munro@enterprisedb.com, bhushan.uparkar@gmail.com, a.korotkov@postgrespro.ru
Subject: Re: Index Skip Scan
In-Reply-To: <1567020711705.41641@Optiver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox