Is this best performed using a trigger?

From: Some Developer <someukdeveloper(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Is this best performed using a trigger?
Date: 2013-06-12 16:15:41
Message-ID: 51B89EAD.5060305@googlemail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I'm trying to decide if this task is best performed using triggers or
some other method in the application itself.

Basically I have two tables. When I insert (or update) data in one table
I want to compare the inserted or updated data with the already existing
data in the other table and see if there are any matches. If there are I
want to flag up that match somehow (I haven't decided on how to do that
just yet but lets just say it'll send an email or something for the
purposes of this question).

So given the fact that I need to ensure the best possible performance
whilst also acknowledging that there could be a significant amount of
data in the tables would a trigger function be the best method to use?

Assuming a trigger function is the best method to use would it be
beneficial to write it in C or would there only be a negligible
performance increase by doing so and that using PL/pgSQL would be better
simply for ease of use and deployment?

Browse pgsql-novice by date

  From Date Subject
Next Message Athanasios Kostopoulos 2013-06-14 08:08:32 tutorial/instructions for postgres 9.1 master-master setup
Previous Message Sergey Konoplev 2013-06-11 19:48:05 Re: DB design advice