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

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: "Bossart, Nathan" <bossartn(at)amazon(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [Proposal] Allow users to specify multiple tables in VACUUM commands
Date: 2017-09-05 03:05:01
Message-ID: CAD21AoCWqsVUk0gv532b5VsZyaYTEhs24x8QMa5b4XAhH6sP_g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 5, 2017 at 10:16 AM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Mon, Sep 4, 2017 at 11:47 PM, Bossart, Nathan <bossartn(at)amazon(dot)com> wrote:
>> I've made this change in v14 of the main patch.
>>
>> In case others had opinions regarding the de-duplication patch, I've
>> attached that again as well.
>
> + /*
> + * Create the relation list in a long-lived memory context so that it
> + * survives transaction boundaries.
> + */
> + old_cxt = MemoryContextSwitchTo(AutovacMemCxt);
> + rangevar = makeRangeVar(tab->at_nspname, tab->at_relname, -1);
> + rel = makeVacuumRelation(rangevar, NIL, tab->at_relid);
> + rel_list = list_make1(rel);
> + MemoryContextSwitchTo(old_cxt);
> That's way better, thanks for the new patch.
>
> So vacuum_multiple_tables_v14.patch is good for a committer in my
> opinion.

In get_rel_oids() we often switch the memory context to vac_context
and switch back. As a result almost code in get_rel_oids() is working
in vac_context. Maybe we can switch memory context before and after
the calling get_rel_oids?

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-09-05 03:24:37 Re: [Proposal] Allow users to specify multiple tables in VACUUM commands
Previous Message Andres Freund 2017-09-05 02:51:48 Re: Function to move the position of a replication slot