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 1gUYFx-0006VV-7F for pgsql-general@arkaria.postgresql.org; Wed, 05 Dec 2018 14:34:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gUYFv-00039W-WA for pgsql-general@arkaria.postgresql.org; Wed, 05 Dec 2018 14:34:27 +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 1gUYFv-00039P-F3 for pgsql-general@lists.postgresql.org; Wed, 05 Dec 2018 14:34:27 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gUYFr-0006I7-Jh for pgsql-general@postgresql.org; Wed, 05 Dec 2018 14:34:26 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0862621F93 for ; Wed, 5 Dec 2018 09:34:22 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 05 Dec 2018 09:34:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=withers.org; h= to:from:subject:message-id:date:mime-version:content-type :content-transfer-encoding; s=mesmtp; bh=TndhhLdHoY7nMptdriTh8cy xsze8U2o2menGX3RBbw0=; b=gB9sPEAe+/a2ZGBI/KMGeKeMw3abC+xZ3/PR3xk a2Qr0SRgk62KVSfGraw8q713ursFBux0yOVsgdkt/F2zV1JzRcV6OniNr8AoU8nE qmDsT/Lfei4E/zw4/SfWwwUrcaucr16H2iI+x6XHCCLrqyCo+nu3ga1Cmy1veli2 Kzu8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=TndhhL dHoY7nMptdriTh8cyxsze8U2o2menGX3RBbw0=; b=GFHtb9csGdfnKhryguV+fG NWvXaDszWPelrcpGddeVrDROowrPTGLEcSco714PFTw+xfiZyeyPD5RIdgpzKBJU J0k59/JCGVnNcaByhI63a2qu0/eAMwduQ/9NjKpQHWZhuXHJMsrJ9uZU9wgMOuGW M3EWYYZJuWWijQeWl4ygz9fDX5BjAqVLf+2tfp+3MB6rvdPLQx+DOZU2cneUVXUA gM1x+H2sB020m0eCE2+PUz8CQ52XEMPnkq2HpYdLdY2uYqwe6yeQg8YOx4Yae4Hn I9ezqUfhy4XE9ZRnMsohKLZ20bDJBlFv6v/6+H6cTZeWPftLggwLF4hyR4ei2wNg == X-ME-Sender: X-ME-Proxy: Received: from [172.25.22.95] (unknown [213.174.214.6]) by mail.messagingengine.com (Postfix) with ESMTPA id 10432E4430 for ; Wed, 5 Dec 2018 09:34:19 -0500 (EST) To: pgsql-general From: Chris Withers Subject: debugging intermittent slow updates under higher load Message-ID: Date: Wed, 5 Dec 2018 14:34:18 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:64.0) Gecko/20100101 Thunderbird/64.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi All, This is on postgres 9.4.16, same table as the last question I asked, here's an abbreviated desc: # \d alerts_alert               Table "public.alerts_alert"      Column      |           Type           | Modifiers -----------------+--------------------------+-----------  tags            | jsonb                    | not null  id              | character varying(86)    | not null ... Indexes:     "alerts_alert_pkey" PRIMARY KEY, btree (id) The table has around 1.5M rows which have been updated/inserted around 121M times, the distribution of updates to row in alerts_alert will be quite uneven, from 1 insert up to 1 insert and 0.5M updates. Under high load (200-300 inserts/updates per second) we see occasional (~10 per hour) updates taking excessively long times (2-10s). These updates are always of the form: UPDATE "alerts_alert" SET ...bunch of fields... WHERE "alerts_alert"."id" = '...sha1 hash...'; Here's a sample explain: https://explain.depesz.com/s/Fjq8 What could be causing this? What could we do to debug? What config changes could we make to alleviate this? cheers, Chris