Re: [GENERAL] Question about loading up a table - Mailing list pgsql-general

From Scott Marlowe
Subject Re: [GENERAL] Question about loading up a table
Date
Msg-id CAOR=d=2LTUXwTheztHuw5aE-jX--bFvsYiVvAjNLi+M5OrSVwA@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] Question about loading up a table  (vinny <vinny@xs4all.nl>)
Responses Re: [GENERAL] Question about loading up a table  (Alex Samad <alex@samad.com.au>)
List pgsql-general
On Mon, Jul 31, 2017 at 2:31 AM, vinny <vinny@xs4all.nl> wrote:
> On 2017-07-31 11:02, Alex Samad wrote:
>>
>> Hi
>>
>> I am using pg_dump | psql to transfer data from my old 9.2 psql into a
>> 9.6 psql.

Note that you should be doing pg_dump with 9.6's pg_dump, as it's
possible for 9.2's pg_dump to not know about a 9.6 feature.

>> The new DB server is setup as master replicating to a hot standby
>> server.
>>
>> What I have noticed is that the rows don't get replicated over until
>> the copy from stdin is finished...  hard to test when you have M+ lines
>> of rows.

SNIP

>> Is there a way to tell the master to replicate earlier
>
> I highly doubt it, because the master cannot know what to replicate until
> your transaction is ended with a COMMIT. If you end with ROLLBACK,
> or your last query is DELETE FROM (your_table>;
> then there isn't even anything to replicate at all...

This is actually a visibility issue. All the new changes are
replicated to the slave, but just like on the master, other
connections can't see the change because it's not visible. The slave,
except for some small delay (seconds etc) is an exact replica of the
master. So even a delete at the end gets replicated. You just don't
see anything but possible table bloat to show for it.

To prove this to oneself, start the copy, and get into another session
to the master. You don't see any rows there either until the commit
after the copy.


pgsql-general by date:

Previous
From: Ed Behn
Date:
Subject: Re: [GENERAL] Partitioned TEMP tables
Next
From: Scott Marlowe
Date:
Subject: Re: [GENERAL] partitioning question