pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: George Woodring <george.woodring@iglass.net>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Why adding BEFORE TRIGGER affect client CPU?
Date: Fri, 18 Jan 2019 14:01:00 -0500
Message-ID: <1130.1547838060@sss.pgh.pa.us> (raw)
In-Reply-To: <6e15d38d-e6f9-1836-15db-5b4e5e9f3a94@aklaver.com>
References: <CACi+J=TxCX-upWaK4dDHm86bWM=cJ=kc0ax3O8CQrvprAghD7w@mail.gmail.com>
	<6e15d38d-e6f9-1836-15db-5b4e5e9f3a94@aklaver.com>

Adrian Klaver <adrian.klaver@aklaver.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




view thread (5+ messages)  latest in thread

Message-ID: <1130.1547838060@sss.pgh.pa.us>
Permalink:  ../1130.1547838060@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1130.1547838060@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, adrian.klaver@aklaver.com, george.woodring@iglass.net
  Subject: Re: Why adding BEFORE TRIGGER affect client CPU?
  In-Reply-To: <1130.1547838060@sss.pgh.pa.us>
  References: <CACi+J=TxCX-upWaK4dDHm86bWM=cJ=kc0ax3O8CQrvprAghD7w@mail.gmail.com> <6e15d38d-e6f9-1836-15db-5b4e5e9f3a94@aklaver.com> <1130.1547838060@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox