Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kbSPh-0007QH-AG for pgsql-general@arkaria.postgresql.org; Sat, 07 Nov 2020 17:54:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kbSPf-0005j0-Rs for pgsql-general@arkaria.postgresql.org; Sat, 07 Nov 2020 17:54:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kbSPe-0005it-61 for pgsql-general@lists.postgresql.org; Sat, 07 Nov 2020 17:54:07 +0000 Received: from [64.147.123.21] (helo=wout5-smtp.messagingengine.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kbSPV-0006Cm-Ru for pgsql-general@postgresql.org; Sat, 07 Nov 2020 17:54:05 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 3BB98F58; Sat, 7 Nov 2020 12:53:45 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sat, 07 Nov 2020 12:53:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=j HywMB2CdbSkznqfJnH8zGPLseyrx1SbtCw+IDJRO2o=; b=HtXS5EoHjIR4rjgmH 61W4aKooqIuXHFiwSmZcPjF01ZVcUwkKaV6PKy+AOXCHAb5QiDqGpCCUBcFyR4Qm 4kTd5H6pjGZc/i4n+n6U1ExylVdrOFRILdAKxyxz5YjpVBwDs9Jn9YfgteLfBEwu GSDTOxBnTwpFUJsq+OTZ0WBabyitru+piwDE6NYFBUWsHBnSH4VDlR4dvdq83lQY ZG/LeIPOa+fZ4X8LnXBxTyG7Zv/b9nUjHjbca3f+kjDzzhKTgClk/g5UhYrTG6/q 92bxeyJuMuvh9IHr2Q9EQDWdLJv18HHRxPmZSQ3hOkBMuFlcNxMTwo98w2tsMO15 u3nYQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=jHywMB2CdbSkznqfJnH8zGPLseyrx1SbtCw+IDJRO 2o=; b=FPVPcatd4QV9WCAIh0JXin9n5GOd3Q18OrtMXTV7qHWWeS9816wS3WlTP 2S1IXNuXyA2MQTGm67Bx3l+0pMeozicwCsCu6+Of+PraJ9ghsfRY3jQ1b6wRhX8z yJlNseDmM6B2VSgHo4omkpiBcU1tOALMUgMkK8RE5ZJ+f1DStg91NjOGR7X4dXg4 vEiR0QcD7YNv3yutGO0JpYl9isJa+vfGwF3FuWB3MLf0LoU0mLmvFdIkFEpa9h6J 9dZ/qzc5F2JAd78aZxrIzS3mq/HUtSynszXPhVdJaVlERmj51rX6IaNAK4JOiYK3 XYcJs0TYPdZw5uu72KoD/AGIB75cQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudduuddguddtkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuggftrfgrthhtvghrnhepveevfeevfeeugeffkeekhfegieeufffgteeujedv gffhueejjefhkeejleegtdegnecukfhppeejhedrudejvddrudelrddufeelnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: from [192.168.1.4] (75-172-19-139.tukw.qwest.net [75.172.19.139]) by mail.messagingengine.com (Postfix) with ESMTPA id 31B7F3280414; Sat, 7 Nov 2020 12:53:44 -0500 (EST) Subject: Re: pg_bulkload sequential To: =?UTF-8?Q?Leandro_Guimar=c3=a3es?= , pgsql-general References: From: Adrian Klaver Message-ID: Date: Sat, 7 Nov 2020 09:53:43 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 64.147.123.21 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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