Re: Partitioned index can be not dumped

From: Zhihong Yu <zyu(at)yugabyte(dot)com>
To: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Partitioned index can be not dumped
Date: 2021-06-30 21:56:17
Message-ID: CALNJ-vRZxGfz-3u0rWELJ496A4tPKLV6hw1YJEB=N=0Z+7Q0GA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 30, 2021 at 2:32 PM Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
wrote:

> On 2021-Jun-30, Zhihong Yu wrote:
>
> > Hi,
> > nit:
> > - if (hasindex)
> > + if (nindexes > 0)
> >
> > It seems hasindex is no longer needed since nindexes is checked.
>
> It's still used to call vac_update_relstats(). We want nindexes to be 0
> for partitioned tables, but still pass true when there are indexes.
>
Hi,
In that case, I wonder whether nindexes can be negated following the call
to vac_open_indexes().

vac_open_indexes(onerel, AccessShareLock, &nindexes, &Irel);
+ nindexes = -nindexes;

That way, hasindex can be dropped.
vac_update_relstats() call would become:

vac_update_relstats(onerel, -1, totalrows,
- 0, false, InvalidTransactionId,
+ 0, nindexes != 0, InvalidTransactionId,

My thinking is that without hasindex, the code is easier to maintain.

Thanks

> Please don't forget to trim the text of the email you're replying to.
>
> --
> Álvaro Herrera Valdivia, Chile
> https://www.EnterpriseDB.com/
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2021-06-30 21:57:36 Re: Partitioned index can be not dumped
Previous Message Michael Paquier 2021-06-30 21:48:39 Re: New committers: Daniel Gustafsson and John Naylor