pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Ribe <scott_ribe@elevated-dev.com>
To: Sachin Kumar <sachinkumaras@gmail.com>
Cc: Pgsql-admin <pgsql-admin@postgresql.org>
Cc: krishna@thewebconz.com
Cc: pgsql-admin@lists.postgresql.org
Subject: Re: how to make duplicate finding query faster?
Date: Wed, 30 Dec 2020 06:28:26 -0700
Message-ID: <84F2C1B0-3510-410B-8924-0EB7377684A9@elevated-dev.com> (raw)
In-Reply-To: <CALg-PKB92uV1v_R2JTLsr27xUdJaEru-b=Frig_YC=jy9L3X6A@mail.gmail.com>
References: <CALg-PKBPQPBMbNAxf-pF0OLbYs0exC7Vf2Sn3hNPUAJ7Q=mPtA@mail.gmail.com>
	<FEEE2DC4-B506-4B34-80FE-07FCC0ADC61E@elevated-dev.com>
	<CALg-PKB92uV1v_R2JTLsr27xUdJaEru-b=Frig_YC=jy9L3X6A@mail.gmail.com>

> On Dec 30, 2020, at 6:24 AM, Sachin Kumar <sachinkumaras@gmail.com> wrote:
> 
> Yes, I am checking one by one because my goal is to fail the whole upload if there is any duplicate entry and to inform the user that they have a duplicate entry in the file.

That's not what I said, though. If you want to fail the whole copy, then you don't have to check one by one, just try the copy--assuming you have the correct constraints in place.

Unless you want to tell the user *which* rows are duplicates, in which case you can try a variant on my prior suggestion, copy into a temp table, use a join to find duplicates...




view thread (8+ messages)

Message-ID: <84F2C1B0-3510-410B-8924-0EB7377684A9@elevated-dev.com>
Permalink:  ../84F2C1B0-3510-410B-8924-0EB7377684A9@elevated-dev.com/
Also on:    postgresql.org/message-id/84F2C1B0-3510-410B-8924-0EB7377684A9@elevated-dev.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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: scott_ribe@elevated-dev.com, sachinkumaras@gmail.com, krishna@thewebconz.com, pgsql-admin@lists.postgresql.org
  Subject: Re: how to make duplicate finding query faster?
  In-Reply-To: <84F2C1B0-3510-410B-8924-0EB7377684A9@elevated-dev.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