Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gkYsu-0005VJ-C9 for pgsql-general@arkaria.postgresql.org; Fri, 18 Jan 2019 18:28:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gkYss-000350-CW for pgsql-general@arkaria.postgresql.org; Fri, 18 Jan 2019 18:28:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gkYsq-00034t-Kp for pgsql-general@lists.postgresql.org; Fri, 18 Jan 2019 18:28:50 +0000 Received: from [64.147.123.25] (helo=wout2-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gkYsn-0004Ab-3q for pgsql-general@postgresql.org; Fri, 18 Jan 2019 18:28:47 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 8D75C1EE5; Fri, 18 Jan 2019 13:28:23 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 18 Jan 2019 13:28:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=W wpusSZ0k/Qs30Ks++Rk4vi1fwjmLh5ArXaPfUsChlE=; b=qDYCJW8vmM9BY6ocN 7trtPSatbpXcpa0tk0/1q+DU4SqfrlteHB3j5vx4s9FJbAoc9VdGG0sSZPEDJCux aqwofYWDCGSnsclngeLh7mNp9lFt4MGfxA8hFZRR/bJ1FfHHcd2D7YJzoHec3QCf mRJ5liMoKxnCvY0u5325ZeaPzcwNIcLbNkL7y624g82FwXYKQitdsc0bcJcY365V lR5BDE5opL1/95iKjJf0cyvK/nDAhfKnJPDUWBY3Ac/GvtnTfRVIWhwHiG4RdV7f U20y1tkTXaZRoNlKgvP0gqQiLOvsEu3sV8NStG+HSKIBuV4ZuAp55RvxjK2aAHwO CVUtQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=WwpusSZ0k/Qs30Ks++Rk4vi1fwjmLh5ArXaPfUsCh lE=; b=K1GzIztu/ndmfp3q7RQHW28C1XWcO6RN5F7to/1zyfMsE6WTg2dJ8YL1U 0/nD6Z0neDJu+NEZjqJJ3UJtNU+GKolWzzQWFo551qT+7dTrXqJL5bFmKaCkVJbh QpXmdUoKK5yC02dk8qrtfVIPzLzaBupRm4OUhBMrfVAUYKFaaLV7x58zYA9yI06H ix8o6z9o/UN0wMqMZG6PtI6p6S66D8YroDJXDIvB9F/jjTBiNTkb0D71gZSmpO7d s+mRIdw3gSLJ3JCcc5QC2pMw0tXRJrBd33Bw7DiTFxJ0fFfmwqktfxF3ArsoZcm0 LcYPBmSyrN37vDwLFrYg+42dXyrcQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrhedtgdduudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkff gfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceo rggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuffhomhgrihhnpe highhlrghsshdrnhgvthenucfkphepjeegrdelgedrjeefrddvvddvnecurfgrrhgrmhep mhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmne cuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from ranger.suse (unknown [74.94.73.222]) by mail.messagingengine.com (Postfix) with ESMTPA id 5B2DC102C2; Fri, 18 Jan 2019 13:28:22 -0500 (EST) Subject: Re: Why adding BEFORE TRIGGER affect client CPU? To: George Woodring , pgsql-general References: From: Adrian Klaver Message-ID: <6e15d38d-e6f9-1836-15db-5b4e5e9f3a94@aklaver.com> Date: Fri, 18 Jan 2019 10:28:21 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 64.147.123.25 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/18/19 10:23 AM, George Woodring wrote: > We are running 9.6.8-10 on our five postgres clusters. > We have ~25 database per cluster. > We have two servers that update a table in each database. > > During the update process we were running a pgpsql function that > calculated the difference in the new value with the previous.  This > function would do a SELECT to get the previous value from the table and > do the calculation before the UPDATE.  We also have an AFTER TRIGGER to > save the row into a logging table. > > 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? > > Anyone know of a reason why this change would affect the client?  I > would think that this would only affect the server side.  I could not > see any messages printed out anywhere in logs showing any type of error. > > Thanks, > George Woodring > iGLASS Networks > www.iglass.net -- Adrian Klaver adrian.klaver@aklaver.com