Re: PoC Refactor AM analyse API

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Denis Smirnov <sd(at)arenadata(dot)io>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: PoC Refactor AM analyse API
Date: 2020-12-27 17:11:10
Message-ID: DC63AF76-FF80-4A5A-8AD4-89D807DB1E9B@yandex-team.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 8 дек. 2020 г., в 16:44, Denis Smirnov <sd(at)arenadata(dot)io> написал(а):
>
> Andrey, thanks for your feedback!
>
> I agree that AMs with fix sized blocks can have much alike code in acquire_sample_rows() (though it is not a rule). But there are several points about current master sampling.
>
> * It is not perfect - AM developers may want to improve it with other sampling algorithms.
> * It is designed with a big influence of heap AM - for example, RelationGetNumberOfBlocks() returns uint32 while other AMs can have a bigger amount of blocks.
> * heapam_acquire_sample_rows() is a small function - I don't think it is not a big trouble to write something alike for any AM developer.
> * Some AMs may have a single level sampling (only algorithm Z from Vitter for example) - why not?
>
> As a result we get a single and clear method to acquire rows for statistics. If we don’t modify but rather extend current API ( for example in a manner it is done for FDW) the code becomes more complicated and difficult to understand.

This makes sense. Purpose of the API is to provide flexible abstraction. Current table_scan_analyze_next_block()/table_scan_analyze_next_tuple() API assumes too much about AM implementation.
But why do you pass int natts and VacAttrStats **stats to acquire_sample_rows()? Is it of any use? It seems to break abstraction too.

Best regards, Andrey Borodin.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2020-12-27 17:25:26 Re: Proposed patch for key managment
Previous Message Laurenz Albe 2020-12-27 15:16:03 Re: Add session statistics to pg_stat_database