Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIXBn-0004i8-SH for pgsql-general@arkaria.postgresql.org; Fri, 02 Nov 2018 11:00:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gIXBm-0007Zh-4I for pgsql-general@arkaria.postgresql.org; Fri, 02 Nov 2018 11:00:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIXBl-0007Za-OW for pgsql-general@lists.postgresql.org; Fri, 02 Nov 2018 11:00:29 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gIXBd-0001fD-US for pgsql-general@postgresql.org; Fri, 02 Nov 2018 11:00:28 +0000 Received: from smtp1.mailbox.org (unknown [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id C4773A2CD2; Fri, 2 Nov 2018 12:00:17 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id 1V9g37iSE7Uo; Fri, 2 Nov 2018 12:00:06 +0100 (CET) Message-ID: <44fa6ec751eb8473583edfbf56d51fb7c229bab9.camel@cybertec.at> Subject: Re: Working around, or with, bitmap heap scan? From: Laurenz Albe To: "James A. Robinson" , pgsql-general@postgresql.org Date: Fri, 02 Nov 2018 12:00:05 +0100 In-Reply-To: References: Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk James A. Robinson wrote: > I'm newly exposed to a Postgres 9.4 database system, and am > trying to understand how I might optimize a query that is taking > a long time to return. > > What I'm observing is an uncached query that takes much much > longer to complete, sometimes minutes longer, when > enable_bitmapscan is true. Even after the query result is > cached, it seems to consistently be 300 ms slower when > enable_bitmapscan is true (so taking 900 ms to return instead of > 600 ms). It would be helpful to have EXPLAIN (ANALYZE, BUFFERS) output for both queries. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com