Re: Why adding BEFORE TRIGGER affect client CPU?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: George Woodring <george(dot)woodring(at)iglass(dot)net>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Why adding BEFORE TRIGGER affect client CPU?
Date: 2019-01-18 19:01:00
Message-ID: 1130.1547838060@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> writes:
> On 1/18/19 10:23 AM, George Woodring wrote:
>> We recently changed the process to do a BEFORE TRIGGER to do the
>> calculation between OLD and NEW instead of the separate function with
>> the SELECT.

> So what was the exact change?

>> After doing this, CPU on our two client servers went crazy.  CPU on the
>> database servers look unchanged.  Rolling back this change fixed our
>> client CPU issue.

> What is the client server and what is it doing?

Indeed. There's no direct way that messing with a trigger would have
caused extra CPU on the client side. I speculate that the trigger
caused the data to look different in a way that your client app wasn't
expecting, causing it to do something funny --- maybe loop trying to
find a matching record, or something like that. Or maybe removing the
step that did the calculation client-side had side effects you weren't
expecting --- what uses that value client-side, exactly?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter J. Holzer 2019-01-18 19:32:48 Re: Oracke BLOB to Postgres BYTEA using ora2pg
Previous Message Adrian Klaver 2019-01-18 18:28:21 Re: Why adding BEFORE TRIGGER affect client CPU?