Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPagt-00072n-Ch for pgsql-performance@arkaria.postgresql.org; Mon, 26 Jun 2017 20:32:59 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dPags-0000MA-S4 for pgsql-performance@arkaria.postgresql.org; Mon, 26 Jun 2017 20:32:58 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dPagr-0000LN-SP for pgsql-performance@postgresql.org; Mon, 26 Jun 2017 20:32:58 +0000 Received: from vapor.isi.edu ([128.9.64.64]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dPagp-0004g8-El for pgsql-performance@postgresql.org; Mon, 26 Jun 2017 20:32:56 +0000 Received: from moraine.isi.edu (moraine.isi.edu [128.9.64.90]) by vapor.isi.edu (8.13.8/8.13.8) with ESMTP id v5QKWTqj026231; Mon, 26 Jun 2017 13:32:29 -0700 (PDT) Date: Mon, 26 Jun 2017 13:32:21 -0700 From: Karl Czajkowski To: Chris Wilson Cc: pgsql-performance@postgresql.org, george.saklatvala@cantabcapital.com Subject: Re: Fwd: Slow query from ~7M rows, joined to two tables of ~100 rows each Message-ID: <20170626203221.GA10516@moraine.isi.edu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ISI-4-43-8-MailScanner: Found to be clean X-MailScanner-From: karlcz@isi.edu 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 On Jun 26, Chris Wilson modulated: > I created the index starting with date and it did make a big > difference: down to 10.3 seconds using a bitmap index scan and bitmap > heap scan (and then two hash joins as before). > By the way, what kind of machine are you using? CPU, RAM, backing storage? I tried running your original test code and the query completed in about 8 seconds, and adding the index changes and analyze statement brought it down to around 2.3 seconds on my workstation with Postgres 9.5.7. On an unrelated development VM with Postgres 9.6.3, the final form took around 4 seconds. Karl -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance