Re: Statement-level Triggers For Uniqueness Checks

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Statement-level Triggers For Uniqueness Checks
Date: 2018-12-25 09:00:19
Message-ID: CAEZATCWYLTkjZNvs_ihGZpE8U6n3LuY3LRviP+BJ6ExZrskf1g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 25 Dec 2018 at 08:04, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
> Take a look at this code in AfterTriggerSaveEvent():
>

Note that the intention behind that code is that in the (fairly
common) case where an insert or update operation is known to not lead
to any potential PK/UNIQUE index violations, the overhead for the
deferred recheck is minimal. For example, consider a bulk insert where
IDs come from a sequence known to not overlap with existing IDs. In
that case, each new ID is determined at index insertion time to not
possibly conflict with any existing ID, recheckIndexes remains empty
for each row, and no recheck triggers are ever queued.

One of the tricky things about replacing the current rechecks with
statement level triggers will be working out how to deal with such
cases (or cases with just a tiny fraction of keys to be rechecked)
without introducing a large overhead.

Regards,
Dean

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-12-25 09:05:59 Re: pg_dumpall --exclude-database option
Previous Message Fabien COELHO 2018-12-25 08:36:05 Re: pg_dumpall --exclude-database option