Re: [Proposal] Allow users to specify multiple tables in VACUUM commands
Michael Paquier <michael.paquier@gmail.com>
From: Michael Paquier <michael.paquier@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: "Bossart, Nathan" <bossartn@amazon.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>,
Tom Lane <tgl@sss.pgh.pa.us>, Masahiko Sawada <sawada.mshk@gmail.com>
Date: 2017-08-28T22:28:17Z
Lists: pgsql-hackers
On Sat, Aug 26, 2017 at 8:00 AM, Robert Haas <robertmhaas@gmail.com> wrote: > On Thu, Aug 24, 2017 at 12:59 AM, Michael Paquier > <michael.paquier@gmail.com> wrote: >> Robert, Amit and other folks working on extending the existing >> partitioning facility would be in better position to answer that, but >> I would think that we should have something as flexible as possible, >> and storing a list of relation OID in each VacuumRelation makes it >> harder to track the uniqueness of relations vacuumed. I agree that the >> concept of a partition with multiple parents induces a lot of >> problems. But the patch as proposed worries me as it complicates >> vacuum() with a double loop: one for each relation vacuumed, and one >> inside it with the list of OIDs. Modules calling vacuum() could also >> use flexibility, being able to analyze a custom list of columns for >> each relation has value as well. > > So ... why have a double loop? I mean, you could just expand this out > to one entry per relation actually being vacuumed, couldn't you? Yes, if I understand that correctly. That's the point I am exactly coming at. My suggestion is to have one VacuumRelation entry per relation vacuumed, even for partitioned tables, and copy the list of columns to each one. > + oldcontext = MemoryContextSwitchTo(vac_context); > + foreach(lc, relations) > + temp_relations = lappend(temp_relations, copyObject(lfirst(lc))); > + MemoryContextSwitchTo(oldcontext); > + relations = temp_relations; > > Can't we just copyObject() on the whole list? Yup. -- Michael
Commits
-
Allow multiple tables to be specified in one VACUUM or ANALYZE command.
- 11d8d72c27a6 11.0 landed
-
Give a better error for duplicate entries in VACUUM/ANALYZE column list.
- ea31541f5648 9.6.6 landed
- e56facd8b300 9.2.24 landed
- b572b435ca67 9.4.15 landed
- a2b1eb23496e 10.0 landed
- a09d8be7ddaf 9.3.20 landed
- 71480501057f 11.0 landed
- 122289a66b92 9.5.10 landed
-
Reject ANALYZE commands during VACUUM FULL or another ANALYZE.
- e415b469b33b 9.5.0 cited