Re: Gsoc2012 idea, tablesample - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Gsoc2012 idea, tablesample
Date
Msg-id CAM-w4HNW6ZyNvHNPcYNDfO=v5gy6ArJ4hFS3rnMBBFNOdBhmiw@mail.gmail.com
Whole thread Raw
In response to Re: Gsoc2012 idea, tablesample  (Stephen Frost <sfrost@snowman.net>)
List pgsql-hackers
On Tue, Apr 17, 2012 at 2:49 PM, Stephen Frost <sfrost@snowman.net> wrote:
> * Heikki Linnakangas (heikki.linnakangas@enterprisedb.com) wrote:
>> 1. We probably don't want the SQL syntax to be added to the grammar.
>> This should be written as an extension, using custom functions as
>> the API, instead of extra SQL syntax.
>
> Err, I missed that, and don't particularly agree with it..  Is there a
> serious issue with the grammar defined in the SQL standard?  The other
> DBs which provide this- do they use the SQL grammar or something else?
>
> I'm not sure that I particularly *like* the SQL grammar, but if we're
> going to implement this, we should really do it 'right'.

I think the danger is that fiddling with the grammar can be a ratsnest
of learning how to deal with bison grammars and learning how to
interpret the ANSI standard and bikeshedding. These are all parts of
the open source world so maybe an argument could be made they should
be part of a GSOC project but I fear they would swallow the whole
project.

But I think I agree that doing it as an external module would be
strange and not very useful. I picture it instead as a new scan type
which is basically a copy of  heapscan or tidscan and uses various
algorithms to decide which tuples to return. For a first cut pof I
would leave out the grammar and just have a guc that enabled replacing
the heap scan with a sample scan everywhere.

But that would have to be done as a patch to Postgres to add the new
scan type. It wouldn't make it much easier to have a hook that
replaced one scan type with another I don't think.

--
greg


pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: 9.3 Pre-proposal: Range Merge Join
Next
From: Qi Huang
Date:
Subject: Re: Gsoc2012 idea, tablesample