Re: TABLESAMPLE patch is really in pretty sad shape

From: Petr Jelinek <petr(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: TABLESAMPLE patch is really in pretty sad shape
Date: 2015-07-23 09:53:28
Message-ID: 55B0B998.3010804@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-07-23 02:01, Tom Lane wrote:
> This needs to work more like LIMIT, which doesn't try to compute the
> limit parameters until the first fetch. So what we need is an Init
> function that does very darn little indeed (maybe we don't even need
> it at all), and then a ParamInspect function that is called at first fetch
> or during a ReScan, and that one is the one that gets to look at the
> evaluated parameter values.
>

If we replace the Begin and ReScan interfaces by single interface the
Init would definitely be optional (all it would do so far is palloc the
tsmdata which can be done easily in the new interface if tsmdata is
NULL). I don't like the ParamInspect name as that function needs to
setup the state for the sampling method (and that's true no matter if we
have Init or not), I think something like BeginScan works better, but it
must be clearly documented that it's called for ReScan as well.

> If we wanted to let the method inspect the HeapScanDesc during setup
> it would need still a third callback. I'm not exactly sure if that's
> worth the trouble.

I tend to agree with this. As I said previously, all that the sampling
method needs to know should be obtainable via Relation which will be set
in any case.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thakur, Sameer 2015-07-23 10:18:10 Re: [PROPOSAL] VACUUM Progress Checker.
Previous Message Thakur, Sameer 2015-07-23 09:44:17 Re: [PROPOSAL] VACUUM Progress Checker.