Re: Statistics Import and Export

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Magnus Hagander <magnus(at)hagander(dot)net>, Stephen Frost <sfrost(at)snowman(dot)net>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, alvherre(at)alvh(dot)no-ip(dot)org, Noah Misch <noah(at)leadboat(dot)com>
Subject: Re: Statistics Import and Export
Date: 2025-01-23 07:49:29
Message-ID: Z5H0iRaJc1wnDVLE@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 21, 2025 at 10:21:51PM -0500, Corey Huinker wrote:
> After some research, I think that we should treat partitioned indexes like
> we were before, and just handle the existing special case for regular
> indexes.

Hmm, why? Sounds strange to me to not have the same locking semantics
for the partitioned parts, and this even if partitioned indexes don't
have stats that can be manipulated in relation_stats.c as far as I
can see. These stats APIs are designed to be permissive as Jeff says.
Having a better locking from the start makes the whole picture more
consistent, while opening the door for actually setting real stat
numbers for partitioned indexes (if some make sense, at some point)?

> That patch is attached below, along with a few updates to pg_dump.
> There are more changes in the works addressing your earlier feedback, but
> those seem to break as many things as they fix, so I'm still working on
> them.

if ((rel->rd_rel->relkind == RELKIND_INDEX
- || (rel->rd_rel->relkind == RELKIND_PARTITIONED_INDEX))
+ || (rel->rd_rel->relkind == RELKIND_PARTITIONED_INDEX))
&& (rel->rd_indexprs != NIL)
&& (rel->rd_index->indkey.values[attnum - 1] == 0))
{

Some noise.

+/* Test for proper locking */

Could it be possible to not mix the style of the comments in
stats_import.sql?

stats_utils.c does not need storage/lockdefs.h. The order of
catalog/index.h is incorrect.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-01-23 08:05:30 Re: per backend WAL statistics
Previous Message Bertrand Drouvot 2025-01-23 07:42:48 Re: POC: enable logical decoding when wal_level = 'replica' without a server restart