Re: Merging statistics from children instead of re-sampling everything

From: Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
To: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Merging statistics from children instead of re-sampling everything
Date: 2021-06-30 12:55:38
Message-ID: 82fcba0a-7c50-c714-2a6b-f2677affe65d@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sorry, I forgot to send CC into pgsql-hackers.
On 29/6/21 13:23, Tomas Vondra wrote:
> Because sampling is fairly expensive, especially if you have to do it
> for large number of child relations. And you'd have to do that every
> time *any* child triggers autovacuum, pretty much. Merging the stats is
> way cheaper.
>
> See the other thread linked from the first message.
Maybe i couldn't describe my idea clearly.
The most commonly partitioning is used for large tables.
I suppose to store a sampling reservoir for each partition, replace on
update of statistics and merge to build statistics for parent table.
It can be spilled into tuplestore on a disk, or stored in a parent table.
In the case of complex inheritance we can store sampling reservoirs only
for leafs.
You can consider this idea as an imagination, but the merging statistics
approach has an extensibility problem on another types of statistics.
>
>
> On 6/29/21 9:01 AM, Andrey Lepikhov wrote:
>> On 30/3/21 03:51, Tomas Vondra wrote:
>>> Of course, that assumes the merge is cheaper than processing the list of
>>> statistics, but I find that plausible, especially the list needs to be
>>> processed multiple (e.g. when considering different join orders, filters
>>> and so on).
>> I think your approach have a chance. But I didn't understand: why do
>> you merge statistics? I think we could merge only samples of each
>> children and build statistics as usual.
>> Error of a sample merging procedure would be quite limited.
>>
>

--
regards,
Andrey Lepikhov
Postgres Professional

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2021-06-30 12:58:31 Re: Preventing abort() and exit() calls in libpq
Previous Message David Rowley 2021-06-30 12:42:53 Re: Remove redundant initializations