Re: TABLESAMPLE patch

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Petr Jelinek <petr(at)2ndquadrant(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(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-18 11:38:44
Message-ID: CAB7nPqTbcvbrnTAeXkphWT2gz6TdM4X-zNq+_nnYmQvBGmuckQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 17, 2015 at 10:54 PM, Petr Jelinek wrote:
> On 10/04/15 06:46, Michael Paquier wrote:
>> 13) Some regression tests with pg_tablesample_method would be welcome.
>
> Not sure what you mean by that.

I meant a sanity check on pg_tablesample_method to be sure that
tsminit, tsmnextblock and tsmnexttuple are always defined as they are
mandatory functions. So the idea is to add a query like and and to be
sure that it returns no rows:
SELECT tsmname FROM pg_tablesample_method WHERE tsminit IS NOT NULL OR
tsmnextblock IS NOT NULL OR tsmnexttuple IS NOT NULL;

> - Added two sample contrib modules demonstrating row limited and time
> limited sampling. I am using linear probing for both of those as the builtin
> block sampling is not well suited for row limited or time limited sampling.
> For row limited I originally thought of using the Vitter's reservoir
> sampling but that does not fit well with the executor as it needs to keep
> the reservoir of all the output tuples in memory which would have horrible
> memory requirements if the limit was high. The linear probing seems to work
> quite well for the use case of "give me 500 random rows from table".

Patch 4 is interesting, it shows a direct use of examinetuple to
filter the output.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2015-04-18 15:01:08 Re: Buildfarm client version 4.15 released
Previous Message Amit Kapila 2015-04-18 06:58:36 Re: a fast bloat measurement tool (was Re: Measuring relation free space)