Re: Statistics Import and Export

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, 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-22 03:21:51
Message-ID: CADkLM=fkR-qNc816J=+Y4EzPtGCY+Lvqj+wfPMFvxYZDVK35qQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 21, 2025 at 8:37 PM jian he <jian(dot)universality(at)gmail(dot)com> wrote:

> hi.
> now stats_lock_check_privileges comments need to change?
>
> * Lock relation in ShareUpdateExclusive mode, check privileges, and close
> the
> * relation (but retain the lock).
>
> since the above comments will not be true for RELKIND_INDEX.
> Yes, there are comments within the function explaining the exception.
>
>
> maybe we can incorporate the following
> /*
> * For indexes, we follow what do_analyze_rel() does so as to avoid any
> * deadlocks with analyze/vacuum, which is to take out a
> * ShareUpdateExclusive on table/matview first and only after that take
> * a AccessShareLock on the index itself.
> */
> comments into stats_lock_check_privileges comments section.
>
> other than that, the patch fix looks good to me.
>

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. 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.

Attachment Content-Type Size
v43-0001-Lock-table-first-when-setting-index-relation-sta.patch text/x-patch 8.2 KB
v43-0002-Enable-dumping-of-table-index-stats-in-pg_dump.patch text/x-patch 61.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou (Fujitsu) 2025-01-22 03:30:15 RE: create subscription with (origin = none, copy_data = on)
Previous Message David G. Johnston 2025-01-22 03:11:19 Re: pgbench without dbname worked differently with psql and pg_dump