Prev: [HACKERS] row estimation off the mark when generate_series calls are involved
Next: pgsql: Tune GetSnapshotData() during Hot Standby by avoiding loop
From: Simon Riggs on 20 Apr 2010 15:16 I just noticed that ALTER TABLE foo SET TABLESPACE new_tablespace; doesn't optimise writing WAL, so when streaming enabled it will copy the whole table to WAL and across the wire. My understanding was that ALTER TABLE had been optimised, though not as much as could be in this case. Following patch writes a new WAL record that just says "copy foo to newts" and during replay we flush buffers and then re-execute the copy (but only when InArchiveRecovery). So the copy happens locally on the standby, not copying from primary to standby. We do this just with a little refactoring and a simple new WAL message. So about 64 bytes rather than potentially gigabytes of data, which seems important when using SR. Simple patch, no new concepts, so I figure to apply this now. (Yes, I need to bump WAL format id as well). Objections? -- Simon Riggs www.2ndQuadrant.com |