Re: Question about loading up a table

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: vinny <vinny(at)xs4all(dot)nl>
Cc: Alex Samad <alex(at)samad(dot)com(dot)au>, PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: Question about loading up a table
Date: 2017-07-31 20:59:50
Message-ID: CAOR=d=2LTUXwTheztHuw5aE-jX--bFvsYiVvAjNLi+M5OrSVwA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jul 31, 2017 at 2:31 AM, vinny <vinny(at)xs4all(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2017-07-31 21:04:11 Re: partitioning question
Previous Message Ed Behn 2017-07-31 20:19:14 Re: Partitioned TEMP tables