Re: TABLESAMPLE patch - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: TABLESAMPLE patch
Date
Msg-id CA+U5nMKfP-+2XMsyCWqmq6hHubec+RhTD+P=wN_AOdM4fBTNeg@mail.gmail.com
Whole thread Raw
In response to Re: TABLESAMPLE patch  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: TABLESAMPLE patch
Re: TABLESAMPLE patch
List pgsql-hackers
On 9 April 2015 at 04:12, Michael Paquier <michael.paquier@gmail.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.

-- Simon Riggs                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, RemoteDBA, Training &
Services



pgsql-hackers by date:

Previous
From: Kyotaro HORIGUCHI
Date:
Subject: Re: How about to have relnamespace and relrole?
Next
From: Michael Paquier
Date:
Subject: Re: TABLESAMPLE patch