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 1gXpsd-0003kt-Km for pgsql-admin@arkaria.postgresql.org; Fri, 14 Dec 2018 15:59:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gXpsc-0007co-4a for pgsql-admin@arkaria.postgresql.org; Fri, 14 Dec 2018 15:59:58 +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 1gXpsb-0007cR-Q1 for pgsql-admin@lists.postgresql.org; Fri, 14 Dec 2018 15:59:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXpsZ-0006Zp-F7 for pgsql-admin@lists.postgresql.org; Fri, 14 Dec 2018 15:59:56 +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 wBEFxrld011934; Fri, 14 Dec 2018 10:59:54 -0500 From: Tom Lane To: wambacher@posteo.de cc: pgsql-admin@lists.postgresql.org Subject: Re: finding queries doing sequential search In-reply-to: <6dd2fe53-a93d-a2ca-05aa-325921333dac@posteo.de> References: <6dd2fe53-a93d-a2ca-05aa-325921333dac@posteo.de> Comments: In-reply-to wambacher@posteo.de message dated "Fri, 14 Dec 2018 16:39:30 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <11932.1544803193.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Fri, 14 Dec 2018 10:59:53 -0500 Message-ID: <11933.1544803193@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk wambacher@posteo.de writes: > The log shows me 8.2 Mio index scans (iscan), which is fine,  and right > now 424 sequential scans (sscan) for planet_osm_polygon. see attached image. > I want to locate the query doing this stuff but EXPLAIN won't help > because most querys are dynamicly created. auto_explain might help. Or you could just log_min_duration_statement to capture queries that are running long. regards, tom lane