Re: [HACKERS] REINDEX CONCURRENTLY 2.0
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Andreas Karlsson <andreas@proxel.se>, PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2017-12-21T02:46:27Z
Lists: pgsql-hackers
Michael Paquier wrote: > Well, the idea is really to get rid of that as there are already > facilities of this kind for CREATE TABLE LIKE in the parser and ALTER > TABLE when rewriting a relation. It is not really attractive to have a > 3rd method in the backend code to do the same kind of things, for a > method that is even harder to maintain than the other two. I dislike the backend code that uses SPI and manufacturing node to re-creates indexes. IMO we should get rid of it. Let's not call it "facilities", but rather "grotty hacks". I think before suggesting to add even more code to perpetuate that idea, we should think about going in the other direction. I have not tried to write the code, but it should be possible to have an intermediate function called by ProcessUtility* which transforms the IndexStmt into an internal representation, then calls DefineIndex. This way, all this code that wants to create indexes for backend-internal reasons can create the internal representation directly then call DefineIndex, instead of the horrible hacks they use today creating parse nodes by hand. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Prevent reindex of invalid indexes on TOAST tables
- 8bca5f93547c 12.3 landed
- 61d7c7bce368 13.0 landed
-
Rework handling of invalid indexes with REINDEX CONCURRENTLY
- a6dcf9df4d91 12.0 landed
-
Split builtins.h to a new header ruleutils.h
- 7b1c2a0f2066 9.5.0 cited