What does "Table rewrite" mean?

2018-01-19 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/9.5/static/sql-altertable.html
Description:

I see references to a "table rewrite" all over the place, but I cannot find
one single definition on what that actually means.

What does a table rewrite do?  Does it drop and recreate the table? 
Everywhere I look people describe it with fear and trepedation as if it was
some catastrophically dangerous operation to perform.  What is it?


Re: What does "Table rewrite" mean?

2018-01-19 Thread Tom Lane
=?utf-8?q?PG_Doc_comments_form?=  writes:
> What does a table rewrite do?  Does it drop and recreate the table? 
> Everywhere I look people describe it with fear and trepedation as if it was
> some catastrophically dangerous operation to perform.  What is it?

It means reading the whole table and writing it out in some modified
form (for instance, with some column transformed into a new datatype).
It's not "dangerous" in any way ... but if you've got many GB of data in
the table and you can't afford to have the table locked for a long time,
then it's something to avoid.

regards, tom lane



Re: typo: overlay

2018-01-19 Thread Peter Eisentraut
On 1/18/18 13:35, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
> 
> Page: https://www.postgresql.org/docs/9.4/static/functions-string.html
> Description:
> 
> https://www.postgresql.org/docs/9.4/static/functions-string.html
> 
> in the overlay example, there should only be 'xxx' instead of ''. (the
> 'xxx' is being replaced with 'hom'.)

The example correctly illustrates that the replacement string does not
have to have the same length as the string being replaced.

-- 
Peter Eisentraut  http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services