pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Leandro Guimarães <leo.guimaraes@gmail.com>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: pg_bulkload sequential
Date: Sat, 7 Nov 2020 09:53:43 -0800
Message-ID: <a2fbc0f6-88ac-f855-d7bd-167f4ec62ae4@aklaver.com> (raw)
In-Reply-To: <CAJV35FMQ3d5pzC6BFt3aR_zu7+t9h0P4a4rqXCdn_LTTTnFxGw@mail.gmail.com>
References: <CAJV35FMQ3d5pzC6BFt3aR_zu7+t9h0P4a4rqXCdn_LTTTnFxGw@mail.gmail.com>

On 11/7/20 9:28 AM, Leandro Guimarães wrote:
> Hello,
>    I have a process using pg_bulkload and sometimes i have duplicated 
> keys in my csv file that pg_bulkload uses.
> 
>    My question is: pg_bulkload insert it in sequential order ?
> 
>     Example, if i have the following csv file:
> 
>      key_1;0.00
>      key_1;100.00
> 
>      And use the ON_DUPLICATE_KEEP = NEW in .ctl file, it's guaranteed 
> that the value 0.00 will be overwritten with 100.00? Or pg_bulkload 
> can't guarantee this order?

Assuming they are in that order in the file and you are using DIRECT 
mode I would say that would be the case. In PARALLEL mode, who knows?

In any case I would be dubious of any process that overwrites and 
depends strictly on ordering to do the right thing. You are putting a 
lot of confidence in the data in the CSV file being correctly ordered.

> 
> Thanks!
> Leandro Guimarães
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (2+ messages)

Message-ID: <a2fbc0f6-88ac-f855-d7bd-167f4ec62ae4@aklaver.com>
Permalink:  ../a2fbc0f6-88ac-f855-d7bd-167f4ec62ae4@aklaver.com/
Also on:    postgresql.org/message-id/a2fbc0f6-88ac-f855-d7bd-167f4ec62ae4@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, leo.guimaraes@gmail.com
  Subject: Re: pg_bulkload sequential
  In-Reply-To: <a2fbc0f6-88ac-f855-d7bd-167f4ec62ae4@aklaver.com>
  References: <CAJV35FMQ3d5pzC6BFt3aR_zu7+t9h0P4a4rqXCdn_LTTTnFxGw@mail.gmail.com> <a2fbc0f6-88ac-f855-d7bd-167f4ec62ae4@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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