public inbox for [email protected]
help / color / mirror / Atom feedWhat does "Table rewrite" mean?
5+ messages / 5 participants
[nested] [flat]
* What does "Table rewrite" mean?
@ 2018-01-19 16:03 PG Doc comments form <[email protected]>
2018-01-19 16:33 ` Re: What does "Table rewrite" mean? Tom Lane <[email protected]>
0 siblings, 1 reply; 5+ messages in thread
From: PG Doc comments form @ 2018-01-19 16:03 UTC (permalink / raw)
To: [email protected]; +Cc: [email protected]
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?
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: What does "Table rewrite" mean?
2018-01-19 16:03 What does "Table rewrite" mean? PG Doc comments form <[email protected]>
@ 2018-01-19 16:33 ` Tom Lane <[email protected]>
2018-01-20 10:18 ` Re: What does "Table rewrite" mean? Michael Paquier <[email protected]>
0 siblings, 1 reply; 5+ messages in thread
From: Tom Lane @ 2018-01-19 16:33 UTC (permalink / raw)
To: [email protected]; +Cc: [email protected]
=?utf-8?q?PG_Doc_comments_form?= <[email protected]> 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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: What does "Table rewrite" mean?
2018-01-19 16:03 What does "Table rewrite" mean? PG Doc comments form <[email protected]>
2018-01-19 16:33 ` Re: What does "Table rewrite" mean? Tom Lane <[email protected]>
@ 2018-01-20 10:18 ` Michael Paquier <[email protected]>
2018-01-21 03:47 ` Re: What does "Table rewrite" mean? Alvaro Herrera <[email protected]>
0 siblings, 1 reply; 5+ messages in thread
From: Michael Paquier @ 2018-01-20 10:18 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: [email protected]; [email protected]
On Fri, Jan 19, 2018 at 11:33:43AM -0500, Tom Lane wrote:
> 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.
Yeah that can be costly. Note that WAL corresponding to this data needs
to be generated as well.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, 2-signature.asc)
download
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: What does "Table rewrite" mean?
2018-01-19 16:03 What does "Table rewrite" mean? PG Doc comments form <[email protected]>
2018-01-19 16:33 ` Re: What does "Table rewrite" mean? Tom Lane <[email protected]>
2018-01-20 10:18 ` Re: What does "Table rewrite" mean? Michael Paquier <[email protected]>
@ 2018-01-21 03:47 ` Alvaro Herrera <[email protected]>
2018-01-22 20:59 ` Re: What does "Table rewrite" mean? Ilsa Loving <[email protected]>
0 siblings, 1 reply; 5+ messages in thread
From: Alvaro Herrera @ 2018-01-21 03:47 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Tom Lane <[email protected]>; [email protected]; [email protected]
Michael Paquier wrote:
> On Fri, Jan 19, 2018 at 11:33:43AM -0500, Tom Lane wrote:
> > 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.
>
> Yeah that can be costly. Note that WAL corresponding to this data needs
> to be generated as well.
Maybe we need to document this somewhere, particularly now that we have
a "table_rewrite" event item.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: What does "Table rewrite" mean?
2018-01-19 16:03 What does "Table rewrite" mean? PG Doc comments form <[email protected]>
2018-01-19 16:33 ` Re: What does "Table rewrite" mean? Tom Lane <[email protected]>
2018-01-20 10:18 ` Re: What does "Table rewrite" mean? Michael Paquier <[email protected]>
2018-01-21 03:47 ` Re: What does "Table rewrite" mean? Alvaro Herrera <[email protected]>
@ 2018-01-22 20:59 ` Ilsa Loving <[email protected]>
0 siblings, 0 replies; 5+ messages in thread
From: Ilsa Loving @ 2018-01-22 20:59 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Michael Paquier <[email protected]>; Tom Lane <[email protected]>; [email protected]
That’s all that’s needed, really. It’s impossible to make an
informed decision if there is no way for someone to know what a table
rewrite actually does and how it does it.
/*---------------------------------------------------------------------------------*/
float o=0.075,h=1.5,T,r,O,l,I;/* Ilsa Loving */int
_,L=80,s=3200; int main()
{for(;s%L||(h-=o,T=-2),s;4-(r=/* IT Manager
*/O*O)<(l=I*I)|++ _==L&&
write(1,(--s%L?_<L?--_%6:6:7) /* The Jonah Group */+"Ilsa
L.\n",1)&&(O=I=l=_=r=0,
T+=o /2))O=I*2*O+h,I=l+T-r;} /* 416-304-0860x227 */
On 20 Jan 2018, at 22:47, Alvaro Herrera wrote:
> Michael Paquier wrote:
>> On Fri, Jan 19, 2018 at 11:33:43AM -0500, Tom Lane wrote:
>>> 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.
>>
>> Yeah that can be costly. Note that WAL corresponding to this data
>> needs
>> to be generated as well.
>
> Maybe we need to document this somewhere, particularly now that we
> have
> a "table_rewrite" event item.
>
> --
> Álvaro Herrera https://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2018-01-22 20:59 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-01-19 16:03 What does "Table rewrite" mean? PG Doc comments form <[email protected]>
2018-01-19 16:33 ` Tom Lane <[email protected]>
2018-01-20 10:18 ` Michael Paquier <[email protected]>
2018-01-21 03:47 ` Alvaro Herrera <[email protected]>
2018-01-22 20:59 ` Ilsa Loving <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox