Re: DISTINCT with btree skip scan

From: Vik Fearing <vik(dot)fearing(at)dalibo(dot)com>
To: Thomas Munro <munro(at)ip9(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DISTINCT with btree skip scan
Date: 2014-07-05 01:03:05
Message-ID: 53B74EC9.6060909@dalibo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 07/05/2014 02:17 AM, Thomas Munro wrote:
> As an exercise I hacked up the simplest code I could think of that would
> demonstrate a faster DISTINCT based on skipping ahead to the next
> distinct value in an index-only scan. Please see the attached (extremely
> buggy) patch, and the example session below. (It's against my natural
> instinct to send such half-baked early hacking phase code to the list,
> but thought it would make sense to demo the concept and then seek
> advice, warnings, cease and desist notices etc before pressing on down
> that route!) I would be most grateful for any feedback you might have.

This is called a Loose Index Scan in our wiki[1] which I believe is
based on the terminology used for the same feature in MySQL although I
haven't and shan't check.

This is a feature I would really like to have.

Your benchmarks look promising but unfortunately it blows up for me so I
can't really test it. I have not yet read the patch nor debugged to see
why, but please do keep up work on this. People more expert than I can
tell you whether you're implementing it the right way.

[1] http://wiki.postgresql.org/wiki/Loose_indexscan
--
Vik

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2014-07-05 01:32:11 Re: Aggregate function API versus grouping sets
Previous Message Thomas Munro 2014-07-05 00:17:32 DISTINCT with btree skip scan