Re: TABLESAMPLE patch

From: Petr Jelinek <petr(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Jaime Casanova <jaime(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tomas Vondra <tv(at)fuzzy(dot)cz>
Subject: Re: TABLESAMPLE patch
Date: 2015-04-02 21:36:29
Message-ID: 551DB65D.9060508@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

so here is version 11.

Addressing Tomas' comments:

>
> 1) The documentation of the pg_tablesample_method catalog is missing
> documentation of the 'tsmpagemode' column, which was added later.
>

Fixed.

> 2) transformTableEntry() in parse_clause modifies the comment, in a way
> that made sense before part of the code was moved to a separate
> function. I suggest to revert the comment changes, and instead add
> the comment to transformTableSampleEntry()
>

Fixed.

> 3) The "shared" parts of the block sampler in sampling.c (e.g. in
> BlockSampler_Next) reference Vitter's algorithm (both the code and
> comments) which is a bit awkward as the only part that uses it is
> analyze.c. The other samplers using this code (system / bernoulli)
> don't use Vitter's algorithm.
>

Actually the Vitter's reservoir is implemented by
reservoir_init_selection_state and reservoir_get_next_S functions in the
sampling.c and is used by analyze, file_fdw and postgres_fdw. It was
previously exported from analyze.h/c but I think it's better to have it
together with the block sampling so that we have all the sampling
methods together.

As I mentioned before in this thread I fixed the REPEATABLE keyword
issue and fixed alias (AS) positioning in parser.

I also attached skeleton docs for the API, it could use more work, but I
am afraid I won't come up with something significantly better soon.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
0004-tablesample-api-doc-v1.patch text/x-diff 7.0 KB
0003-tablesample-ddl-v6.patch text/x-diff 60.5 KB
0002-tablesample-v11.patch text/x-diff 113.9 KB
0001-separate-block-sampling-functions-v2.patch text/x-diff 21.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-04-02 22:21:06 Re: Re: Abbreviated keys for Datum tuplesort
Previous Message Peter Geoghegan 2015-04-02 21:34:39 Re: Re: Abbreviated keys for Datum tuplesort