From: | Floris Van Nee <florisvannee(at)Optiver(dot)com> |
---|---|
To: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> |
Cc: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>, Alexander Kuzmenkov <a(dot)kuzmenkov(at)postgrespro(dot)ru>, 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>, Bhushan Uparkar <bhushan(dot)uparkar(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, James Coleman <jtc331(at)gmail(dot)com> |
Subject: | Re: Index Skip Scan |
Date: | 2019-06-01 04:10:23 |
Message-ID: | 1559362223126.18661@Optiver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Actually I'd like to add something to this. I think I've found a bug in the current implementation. Would someone be able to check?
Given a table definition of (market text, feedcode text, updated_at timestamptz, value float8) and an index on (market, feedcode, updated_at desc) (note that this table slightly deviates from what I described in my previous mail) and filling it with data.
The following query uses an index skip scan and returns just 1 row (incorrect!)
select distinct on (market, feedcode) market, feedcode
from streams.base_price
where market='TEST'
The following query still uses the regular index scan and returns many more rows (correct)
select distinct on (market, feedcode) *
from streams.base_price
where market='TEST'
It seems that partially filtering on one of the distinct columns triggers incorrect behavior where too many rows in the index are skipped.
-Floris
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2019-06-01 04:55:47 | Re: coverage additions |
Previous Message | Floris Van Nee | 2019-06-01 04:01:38 | Re: Index Skip Scan |