Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWUdf-0005kP-Q9 for pgsql-performance@arkaria.postgresql.org; Mon, 31 Aug 2015 19:21:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZWUdf-0007AS-9S for pgsql-performance@arkaria.postgresql.org; Mon, 31 Aug 2015 19:21:07 +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) (envelope-from ) id 1ZWUc2-00059W-NJ for pgsql-performance@postgresql.org; Mon, 31 Aug 2015 19:19:26 +0000 Received: from mbob.nabble.com ([162.253.133.15]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZWUc0-0007uB-5z for pgsql-performance@postgresql.org; Mon, 31 Aug 2015 19:19:25 +0000 Received: from msam.nabble.com (unknown [162.253.133.85]) by mbob.nabble.com (Postfix) with ESMTP id 6667E146C8ED for ; Mon, 31 Aug 2015 12:16:26 -0700 (PDT) Date: Mon, 31 Aug 2015 12:19:23 -0700 (MST) From: twoflower To: pgsql-performance@postgresql.org Message-ID: <1441048763332-5864080.post@n5.nabble.com> In-Reply-To: <1441047830983-5864075.post@n5.nabble.com> References: <1441037351126-5864045.post@n5.nabble.com> <55E47E97.1090202@2ndquadrant.com> <1441047830983-5864075.post@n5.nabble.com> Subject: =?UTF-8?Q?Re:_Query_>_1000=C3=97_slowdown_af?= =?UTF-8?Q?ter_adding_datetime_comparison?= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -0.3 (/) 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 And another thing which comes out as a little surprising to me - if I replace the *date_last_updated* condition with another one, say *doc.documenttype = 4*, the query finishes immediately. *documenttype* is an unindexed integer column. Here's the query plan: What's so special about that *date_last_updated* condition that makes it so slow to use? Is it because it involves the *date()* function call that it makes it difficult for the planner to guess the data distribution in the DOCUMENT table? -- View this message in context: http://postgresql.nabble.com/Query-1-000-000-slowdown-after-adding-datetime-comparison-tp5864045p5864080.html Sent from the PostgreSQL - performance mailing list archive at Nabble.com. -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance