Re: ANALYZE command progress checker

From: Tatsuro Yamada <yamada(dot)tatsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ANALYZE command progress checker
Date: 2017-09-07 05:25:04
Message-ID: 59B0D830.6050203@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017/04/05 10:17, Masahiko Sawada wrote:
> On Wed, Apr 5, 2017 at 1:49 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> On Tue, Apr 4, 2017 at 4:57 AM, Amit Langote
>> <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
>>> Hmm, you're right. It could be counted with a separate variable
>>> initialized to 0 and incremented every time we decide to add a row to the
>>> final set of sampled rows, although different implementations of
>>> AcquireSampleRowsFunc have different ways of deciding if a given row will
>>> be part of the final set of sampled rows.
>>>
>>> On the other hand, if we decide to count progress in terms of blocks as
>>> you suggested afraid, I'm afraid that FDWs won't be able to report the
>>> progress.
>>
>> I think it may be time to push this patch out to v11. It was
>> submitted one day before the start of the last CommitFest, the design
>> wasn't really right, and it's not clear even now that we know what the
>> right design is. And we're pretty much out of time.
>>
>
> +1
> We're encountering the design issue and it takes more time to find out
> right design including FDWs support.
>
> Regards,
>
> --
> Masahiko Sawada
> NIPPON TELEGRAPH AND TELEPHONE CORPORATION
> NTT Open Source Software Center

Hi Vinayak,

I found a typo in your patch: s/taht/that/

sampling.c
/* Report total number of blocks taht will be sampled */

Then, regarding FDWs support, I believe it means postgres_fdw support (is my understanding right?).
You might better to put pgstat_progress_update_param() into these functions, maybe.
postgres_fdw.c
- postgresAnalyzeForeignTable
- postgresAcquireSampleRowsFunc

And PgFdwAnalyzeState has these variables, hopefully you can get current number of rows
as a progress indicator.

sturuct PgFdwAnalyzeState
...
/* collected sample rows */
HeapTuple *rows; /* array of size targrows */
int targrows; /* target # of sample rows */
int numrows; /* # of sample rows collected */

/* for random sampling */
double samplerows; /* # of rows fetched */
double rowstoskip; /* # of rows to skip before next sample */
...

I hope it will help you.

Regards,
Tatsuro Yamada

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2017-09-07 05:35:44 Re: Parallel Append implementation
Previous Message Fabien COELHO 2017-09-07 05:19:59 Re: merge psql ef/ev sf/sv handling functions