Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aGprw-0000cX-AV for pgsql-performance@arkaria.postgresql.org; Wed, 06 Jan 2016 15:19:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aGprv-0007hl-TE for pgsql-performance@arkaria.postgresql.org; Wed, 06 Jan 2016 15:19:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aGprv-0007hI-3a for pgsql-performance@postgresql.org; Wed, 06 Jan 2016 15:19:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aGprs-0000uY-1L for pgsql-performance@postgresql.org; Wed, 06 Jan 2016 15:19:22 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u06FJFsI025401; Wed, 6 Jan 2016 10:19:15 -0500 From: Tom Lane To: Scott Rankin cc: "pgsql-performance@postgresql.org" Subject: Re: Queries intermittently slow In-reply-to: <2A061A33-9E7C-44ED-A8A4-411FE128A1C9@motus.com> References: <2A061A33-9E7C-44ED-A8A4-411FE128A1C9@motus.com> Comments: In-reply-to Scott Rankin message dated "Wed, 06 Jan 2016 14:58:05 +0000" Date: Wed, 06 Jan 2016 10:19:15 -0500 Message-ID: <25400.1452093555@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Scott Rankin writes: > I’m trying to track down why some queries on my database system are intermittently much slower than usual. I have some queries that run, on average, 2-3ms, and they run at a rate of about 10-20 queries/second. However, every 3-5 seconds, one of the queries will be 500-100ms. This is making the average query time turn out to be closer to 20ms, with a very large standard deviation. > This happens to a number of otherwise very fast queries, and I’m trying to trace the reason. I’ve turned on lock logging and checkpoint logging, and this behavior happens whether or not a checkpoint is occurring. There are no lock waits happening in the system either. I doubt you've proved that --- log_lock_waits will only report on waits longer than deadlock_timeout, which you don't appear to have changed from its default of 1 sec. If you're trying to capture events that last a few hundred msec, you're going to need to reduce deadlock_timeout to maybe 100ms. It would help to know more about what the queries are, too. The cause might be something like GIN index pending-list cleanup but we can't tell on the basis of this much info. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance