Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWV2q-0006wK-A1 for pgsql-performance@arkaria.postgresql.org; Mon, 31 Aug 2015 19:47:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZWV2p-0006Lq-7e for pgsql-performance@arkaria.postgresql.org; Mon, 31 Aug 2015 19:47:07 +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 1ZWV2o-0006Lh-MI for pgsql-performance@postgresql.org; Mon, 31 Aug 2015 19:47:06 +0000 Received: from mbob.nabble.com ([162.253.133.15]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZWV2g-0001cW-Sc for pgsql-performance@postgresql.org; Mon, 31 Aug 2015 19:47:05 +0000 Received: from msam.nabble.com (unknown [162.253.133.85]) by mbob.nabble.com (Postfix) with ESMTP id 9A2E2146CECB for ; Mon, 31 Aug 2015 12:43:59 -0700 (PDT) Date: Mon, 31 Aug 2015 12:46:56 -0700 (MST) From: twoflower To: pgsql-performance@postgresql.org Message-ID: <1441050416677-5864088.post@n5.nabble.com> In-Reply-To: References: <1441037351126-5864045.post@n5.nabble.com> <55E47E97.1090202@2ndquadrant.com> <1441047830983-5864075.post@n5.nabble.com> <1441048763332-5864080.post@n5.nabble.com> Subject: =?UTF-8?Q?Re:__Re:_Query_>_1000=C3=97_slow?= =?UTF-8?Q?down_after_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 David G Johnston wrote > What happens if you pre-compute the date condition and hard code it? I created a new boolean column and filled it for every row in DOCUMENT with *(doc.date_last_updated >= date(now() - '171:00:00'::interval))*, reanalyzed the table and modified the query to just compare this column to TRUE. I expected this to be very fast, considering that a (to me, anyway) similar query also containing a constant value comparison finishes immediately. However, the query is running now for 4 minutes already. That's really interesting. -- View this message in context: http://postgresql.nabble.com/Query-1-000-000-slowdown-after-adding-datetime-comparison-tp5864045p5864088.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