Re: [Proposal] Allow users to specify multiple tables in VACUUM commands

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: michael(dot)paquier(at)gmail(dot)com
Cc: bossartn(at)amazon(dot)com, pgsql-hackers(at)postgresql(dot)org, sawada(dot)mshk(at)gmail(dot)com, david(dot)g(dot)johnston(at)gmail(dot)com, robertmhaas(at)gmail(dot)com, tgl(at)sss(dot)pgh(dot)pa(dot)us
Subject: Re: [Proposal] Allow users to specify multiple tables in VACUUM commands
Date: 2017-09-13 04:13:16
Message-ID: 20170913.131316.47275094.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello, I began to look on this. (But it seems almost ready for committer..)

At Wed, 13 Sep 2017 11:47:11 +0900, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote in <CAB7nPqTYbJRU14SG0qwueTLbZHutZ8OWCV0L9NiK1MQ_nzqCkw(at)mail(dot)gmail(dot)com>
> On Wed, Sep 13, 2017 at 12:31 AM, Bossart, Nathan <bossartn(at)amazon(dot)com> wrote:
> > Sorry for the spam. I am re-sending these patches with modified names so that
> > the apply order is obvious to the new automated testing framework (and to
> > everybody else).
>
> - * relid, if not InvalidOid, indicate the relation to process; otherwise,
> - * the RangeVar is used. (The latter must always be passed, because it's
> - * used for error messages.)
> [...]
> +typedef struct VacuumRelation
> +{
> + NodeTag type;
> + RangeVar *relation; /* single table to process */
> + List *va_cols; /* list of column names, or NIL for all */
> + Oid oid; /* corresponding OID (filled in by [auto]vacuum.c) */
> +} VacuumRelation;
> We lose a bit of information here. I think that it would be good to
> mention in the declaration of VacuumRelation that the RangeVar is used
> for error processing, and needs to be filled. I have complained about
> that upthread already, perhaps this has slipped away when rebasing.
>
> + int i = attnameAttNum(rel, col, false);
> +
> + if (i != InvalidAttrNumber)
> + continue;
> Nit: allocating "i" makes little sense here. You are not using it for
> any other checks.
>
> /*
> - * Build a list of Oids for each relation to be processed
> + * Determine the OID for each relation to be processed
> *
> * The list is built in vac_context so that it will survive across our
> * per-relation transactions.
> */
> -static List *
> -get_rel_oids(Oid relid, const RangeVar *vacrel)
> +static void
> +get_rel_oids(List **vacrels)
> Yeah, that's not completely correct either. This would be more like
> "Fill in the list of VacuumRelation entries with their corresponding
> OIDs, adding extra entries for partitioned tables".
>
> Those are minor points. The patch seems to be in good shape, and
> passes all my tests, including some pgbench'ing to make sure that
> nothing goes weird. So I'll be happy to finally switch both patches to
> "ready for committer" once those minor points are addressed.

May I ask one question?

This patch creates a new memory context "Vacuum" under
PortalContext in vacuum.c, but AFAICS the current context there
is PortalHeapMemory, which has the same expected lifetime with
the new context (that is, a child of PotalContext and dropeed in
PortalDrop). On the other hand the PortalMemory's lifetime is not
PortalStart to PortaDrop but the backend lifetime (initialized in
InitPostgres).

> /*
> * Create special memory context for cross-transaction storage.
> *
> * Since it is a child of PortalContext, it will go away eventually even
> * if we suffer an error; there's no need for special abort cleanup logic.
> */
> vac_context = AllocSetContextCreate(PortalContext,
> "Vacuum",
> ALLOCSET_DEFAULT_SIZES);

So this seems to work as opposite to the expectation. Am I
missing something?

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-09-13 04:16:52 Re: [Proposal] Allow users to specify multiple tables in VACUUM commands
Previous Message Michael Paquier 2017-09-13 04:12:54 Re: [PATCH] Call RelationDropStorage() for broader range of object drops.