Re: Trigger Performance

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Randall Smith <randall(at)tnr(dot)cc>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Trigger Performance
Date: 2011-01-16 17:36:32
Message-ID: 9362.1295199392@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Randall Smith <randall(at)tnr(dot)cc> writes:
> I've created a trigger that checks the uniqueness of two columns in a
> table. Traditionally, one would use a unique constraint, but in my
> case, the size of the unique index would be too large and some
> performance loss is acceptable. However, the trigger performance seems
> to be far below what's indicated by an explain analyze of the query used
> in the trigger.

You realize of course that this is fundamentally broken and cannot be
trusted? Worrying about the performance seems rather pointless.

The reason it can't be trusted is that two concurrent insertions will
neither see the other one.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Вячеслав Блинников 2011-01-16 17:42:01 Re: libpq: binary data vs textual
Previous Message Andy Colson 2011-01-16 17:28:03 Re: database slowdown