Re: Review of Row Level Security

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Simon Riggs <simon@2ndQuadrant.com>
Cc: Kevin Grittner <kgrittn@mail.com>, Kohei KaiGai <kaigai@kaigai.gr.jp>, Stephen Frost <sfrost@snowman.net>, Robert Haas <robertmhaas@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2012-12-23T19:16:38Z
Lists: pgsql-hackers
Simon Riggs <simon@2ndQuadrant.com> writes:
> On 21 December 2012 16:51, Kevin Grittner <kgrittn@mail.com> wrote:
>> If none, and this is strictly an optimization, what are the benchmarks
>> showing?

> AFAIK its well known that a check constraint is much faster than a
> trigger.

I don't believe that that's "well known" at all, at least not for
apples-to-apples comparison cases.  A C-coded BEFORE trigger doesn't
have very much overhead; I suspect it's probably comparable to
expression evaluation setup overhead.  I think if you want to argue
for this on performance grounds, you need to actually prove there's
a significant performance advantage, not just assume there will be.

			regards, tom lane