pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Does CLUSTER generate WAL data?
5+ messages / 4 participants
[nested] [flat]

* Does CLUSTER generate WAL data?
@ 2016-08-24 23:06  Craig James <cjames@emolecules.com>
  0 siblings, 2 replies; 5+ messages in thread

From: Craig James @ 2016-08-24 23:06 UTC (permalink / raw)
  To: pgsql-admin

I know the CLUSTER command essentially creates a new table, copies the data
in INDEX order, then deletes the original table.

Does that mean all of the data passes through the WAL logs, or is it purely
an internal operation? More specifically, if we're doing streaming
replication, will all of the data for the table being clustered be
transmitted across the network to the hot-standby slave?

Thanks,
Craig

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Does CLUSTER generate WAL data?
@ 2016-08-24 23:49  David G. Johnston <david.g.johnston@gmail.com>
  parent: Craig James <cjames@emolecules.com>
  1 sibling, 1 reply; 5+ messages in thread

From: David G. Johnston @ 2016-08-24 23:49 UTC (permalink / raw)
  To: Craig James <cjames@emolecules.com>; +Cc: pgsql-admin

On Wed, Aug 24, 2016 at 7:06 PM, Craig James <cjames@emolecules.com> wrote:

> I know the CLUSTER command essentially creates a new table, copies the
> data in INDEX order, then deletes the original table.
>
> Does that mean all of the data passes through the WAL logs, or is it
> purely an internal operation? More specifically, if we're doing streaming
> replication, will all of the data for the table being clustered be
> transmitted across the network to the hot-standby slave?
>
>
Not looking at the code but, yes, the replica must be an exact physical
duplicate of the master and since the only ongoing source of data for the
replica is the WAL the actions taken as part of performing a CLUSTER must
be logged.

David J.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Does CLUSTER generate WAL data?
@ 2016-08-25 00:09  Craig James <cjames@emolecules.com>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Craig James @ 2016-08-25 00:09 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-admin

On Wed, Aug 24, 2016 at 4:49 PM, David G. Johnston <
david.g.johnston@gmail.com> wrote:

> On Wed, Aug 24, 2016 at 7:06 PM, Craig James <cjames@emolecules.com>
> wrote:
>
>> I know the CLUSTER command essentially creates a new table, copies the
>> data in INDEX order, then deletes the original table.
>>
>> Does that mean all of the data passes through the WAL logs, or is it
>> purely an internal operation? More specifically, if we're doing streaming
>> replication, will all of the data for the table being clustered be
>> transmitted across the network to the hot-standby slave?
>>
>>
> Not looking at the code but, yes, the replica must be an exact physical
> duplicate of the master and since the only ongoing source of data for the
> replica is the WAL the actions taken as part of performing a CLUSTER must
> be logged.
>

Right, I understand that the WAL has to record the operation. But I'm not
sure that answers the question. If the contents of the WAL are, "copy this
table to that table in index order", then no data from the table itself
will be in the WAL. On the other hand, if the contents of the WAL are
"create a new table, and then insert all of this data", then the WAL
records will be huge.

Which is it?

Thanks,
Craig


> David J.
>
>


-- 
---------------------------------
Craig A. James
Chief Technology Officer
eMolecules, Inc.
---------------------------------

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Does CLUSTER generate WAL data?
@ 2016-08-25 00:14  Scott Ribe <scott_ribe@elevated-dev.com>
  parent: Craig James <cjames@emolecules.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Scott Ribe @ 2016-08-25 00:14 UTC (permalink / raw)
  To: Craig James <cjames@emolecules.com>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; pgsql-admin

On Aug 24, 2016, at 6:09 PM, Craig James <cjames@emolecules.com> wrote:
> 
> Right, I understand that the WAL has to record the operation. But I'm not sure that answers the question. If the contents of the WAL are, "copy this table to that table in index order", then no data from the table itself will be in the WAL. On the other hand, if the contents of the WAL are "create a new table, and then insert all of this data", then the WAL records will be huge.
> 
> Which is it?

WAL records changes at the page level, not commands; so it will be the one you don't want.

-- 
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice







-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Does CLUSTER generate WAL data?
@ 2016-08-25 08:36  jaime soler <jaime.soler@gmail.com>
  parent: Craig James <cjames@emolecules.com>
  1 sibling, 0 replies; 5+ messages in thread

From: jaime soler @ 2016-08-25 08:36 UTC (permalink / raw)
  To: Craig James <cjames@emolecules.com>; pgsql-admin

El mié, 24-08-2016 a las 16:06 -0700, Craig James escribió:
> I know the CLUSTER command essentially creates a new table, copies
> the data in INDEX order, then deletes the original table.
> 
> Does that mean all of the data passes through the WAL logs, or is it
> purely an internal operation? More specifically, if we're doing
> streaming replication, will all of the data for the table being
> clustered be transmitted across the network to the hot-standby slave?
Yes for sure.
> > Thanks,
> Craig
> > 

> 

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2016-08-25 08:36 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-08-24 23:06 Does CLUSTER generate WAL data? Craig James <cjames@emolecules.com>
2016-08-24 23:49 ` David G. Johnston <david.g.johnston@gmail.com>
2016-08-25 00:09   ` Craig James <cjames@emolecules.com>
2016-08-25 00:14     ` Scott Ribe <scott_ribe@elevated-dev.com>
2016-08-25 08:36 ` jaime soler <jaime.soler@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox