Re: TABLESAMPLE patch

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Petr Jelinek <petr(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-09 09:04:06
Message-ID: CAB7nPqRnEivoQ2m89t+K9T3_HpYgh-Jmrgdmb1EZuzEKZqd6rg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 9, 2015 at 5:52 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
> On 9 April 2015 at 04:12, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:
>
>> Also, I am wondering if the sampling logic based on block analysis is
>> actually correct, for example for now this fails and I think that we
>> should support it:
>> =# with query_select as (select generate_series(1, 10) as a) select
>> query_select.a from query_select tablesample system (100.0/11)
>> REPEATABLE (9999);
>> ERROR: 42P01: relation "query_select" does not exist
>>
>> How does the SQL spec define exactly TABLESAMPLE? Shouldn't we get a
>> sample from a result set?
>> Thoughts?
>
> Good catch. The above query doesn't make any sense.
>
> TABLESAMPLE SYSTEM implies system-defined sampling mechanism, which is
> block level sampling. So any block level sampling method should be
> barred from operating on a result set in this way... i.e. should
> generate an "ERROR inappropriate sampling method specified"
>
> TABLESAMPLE BERNOULLI could work in this case, or any other non-block
> based sampling mechanism. Whether it does work yet is another matter.
>
> This query should be part of the test suite and should generate a
> useful message or work correctly.

Ahah, you just beat me on that ;) See a more precise reply below.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2015-04-09 09:09:36 Re: How about to have relnamespace and relrole?
Previous Message Michael Paquier 2015-04-09 09:02:21 Re: TABLESAMPLE patch