pgsql: Implement ALTER TABLE .. SET LOGGED / UNLOGGED
Implement ALTER TABLE .. SET LOGGED / UNLOGGED
This enables changing permanent (logged) tables to unlogged and
vice-versa.
(Docs for ALTER TABLE / SET TABLESPACE got shuffled in an order that
hopefully makes more sense than the original.)
Author: Fabrízio de Royes Mello
Reviewed by: Christoph Berg, Andres Freund, Thom Brown
Some tweaking by Álvaro Herrera
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/f41872d0c1239d36ab03393c39ec0b70e9ee2a3c
Modified Files
--------------
doc/src/sgml/ref/alter_table.sgml | 64 ++++----
src/backend/commands/cluster.c | 46 +++---
src/backend/commands/matview.c | 9 +-
src/backend/commands/tablecmds.c | 239 ++++++++++++++++++++++++++++-
src/backend/parser/gram.y | 17 +-
src/bin/psql/tab-complete.c | 4 +-
src/include/commands/cluster.h | 2 +-
src/include/nodes/parsenodes.h | 2 +
src/include/parser/kwlist.h | 1 +
src/test/regress/expected/alter_table.out | 91 +++++++++++
src/test/regress/sql/alter_table.sql | 52 +++++++
11 files changed, 472 insertions(+), 55 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
On 22 August 2014 19:30, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
Implement ALTER TABLE .. SET LOGGED / UNLOGGED
This enables changing permanent (logged) tables to unlogged and
vice-versa.(Docs for ALTER TABLE / SET TABLESPACE got shuffled in an order that
hopefully makes more sense than the original.)
When moving from unlogged to logged, where do we remove the init fork?
Couldn't see the keywords fork or init anywhere in the patch, so maybe
its hidden somewhere.
--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
On August 23, 2014 3:49:32 PM CEST, Simon Riggs <simon@2ndQuadrant.com> wrote:
On 22 August 2014 19:30, Alvaro Herrera <alvherre@alvh.no-ip.org>
wrote:Implement ALTER TABLE .. SET LOGGED / UNLOGGED
This enables changing permanent (logged) tables to unlogged and
vice-versa.(Docs for ALTER TABLE / SET TABLESPACE got shuffled in an order that
hopefully makes more sense than the original.)When moving from unlogged to logged, where do we remove the init fork?
Couldn't see the keywords fork or init anywhere in the patch, so maybe
its hidden somewhere.
A new relfilenode is filled with the data - the old one, including the init fork, gets removed by the normal mechanics of rewriting rels.
---
Please excuse brevity and formatting - I am writing this on my mobile phone.
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
On 23 August 2014 14:57, Andres Freund <andres@anarazel.de> wrote:
On August 23, 2014 3:49:32 PM CEST, Simon Riggs <simon@2ndQuadrant.com> wrote:
On 22 August 2014 19:30, Alvaro Herrera <alvherre@alvh.no-ip.org>
wrote:Implement ALTER TABLE .. SET LOGGED / UNLOGGED
When moving from unlogged to logged, where do we remove the init fork?
Couldn't see the keywords fork or init anywhere in the patch, so maybe
its hidden somewhere.A new relfilenode is filled with the data - the old one, including the init fork, gets removed by the normal mechanics of rewriting rels.
Why do we do that? Table rewrite takes hours.
If that is a requirement, I don't see it documented. If its a choice,
its a bad one.
--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
On 2014-08-23 17:28:38 +0100, Simon Riggs wrote:
On 23 August 2014 14:57, Andres Freund <andres@anarazel.de> wrote:
On August 23, 2014 3:49:32 PM CEST, Simon Riggs <simon@2ndQuadrant.com> wrote:
On 22 August 2014 19:30, Alvaro Herrera <alvherre@alvh.no-ip.org>
wrote:Implement ALTER TABLE .. SET LOGGED / UNLOGGED
When moving from unlogged to logged, where do we remove the init fork?
Couldn't see the keywords fork or init anywhere in the patch, so maybe
its hidden somewhere.A new relfilenode is filled with the data - the old one, including the init fork, gets removed by the normal mechanics of rewriting rels.
Why do we do that? Table rewrite takes hours.
There was a long thread about it on -hackers. Doing it without a rewrite
and without loosing transactional semantics is really rather hard. And
having the capability of doing it with a rewrite is better than not
having it at all.
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
On 08/23/2014 12:47 PM, Andres Freund wrote:
On 2014-08-23 17:28:38 +0100, Simon Riggs wrote:
On 23 August 2014 14:57, Andres Freund <andres@anarazel.de> wrote:
On August 23, 2014 3:49:32 PM CEST, Simon Riggs <simon@2ndQuadrant.com> wrote:
On 22 August 2014 19:30, Alvaro Herrera <alvherre@alvh.no-ip.org>
wrote:Implement ALTER TABLE .. SET LOGGED / UNLOGGED
When moving from unlogged to logged, where do we remove the init fork?
Couldn't see the keywords fork or init anywhere in the patch, so maybe
its hidden somewhere.A new relfilenode is filled with the data - the old one, including the init fork, gets removed by the normal mechanics of rewriting rels.
Why do we do that? Table rewrite takes hours.
There was a long thread about it on -hackers. Doing it without a rewrite
and without loosing transactional semantics is really rather hard. And
having the capability of doing it with a rewrite is better than not
having it at all.
I think this needs to be documented very clearly and explicitly. My
question about the mechanism was similar to Simon's, and I looked in
vain for any clue about it in the committed docs.
cheers
andrew
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers