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 1hGMgR-0005Jl-FR for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Apr 2019 11:55:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hGMgQ-0003wF-1r for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Apr 2019 11:55:26 +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 1hGMgP-0003vw-MJ for pgsql-hackers@lists.postgresql.org; Tue, 16 Apr 2019 11:55:25 +0000 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hGMgL-0002jg-Rr for pgsql-hackers@lists.postgresql.org; Tue, 16 Apr 2019 11:55:24 +0000 Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x3GBtJhW007736 for ; Tue, 16 Apr 2019 20:55:19 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 5A2F1EA7C65 for ; Tue, 16 Apr 2019 20:55:19 +0900 (JST) Received: from jcms-pop11.ecl.ntt.co.jp (jcms-pop11.ecl.ntt.co.jp [129.60.87.132]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 4F0B1EA7C62 for ; Tue, 16 Apr 2019 20:55:19 +0900 (JST) Received: from hosoyahp (unknown [129.60.241.74]) by jcms-pop11.ecl.ntt.co.jp (Postfix) with ESMTPSA id 4B9CB70C0C1B for ; Tue, 16 Apr 2019 20:55:19 +0900 (JST) From: "Yuzuko Hosoya" Subject: Runtime pruning problem Date: Tue, 16 Apr 2019 20:54:36 +0900 Message-ID: <001001d4f44b$2a2cca50$7e865ef0$@lab.ntt.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 15.0 Content-language: ja Thread-Index: AdT0HG0nBiavexZdQemNfBoOwSP2OA== X-CC-Mail-RelayStamp: 1 To: X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi all, I found a runtime pruning test case which may be a problem as follows: ---- create table t1 (id int, dt date) partition by range(dt); create table t1_1 partition of t1 for values from ('2019-01-01') to ('2019-04-01'); create table t1_2 partition of t1 for values from ('2019-04-01') to ('2019-07-01'); create table t1_3 partition of t1 for values from ('2019-07-01') to ('2019-10-01'); create table t1_4 partition of t1 for values from ('2019-10-01') to ('2020-01-01'); In this example, current_date is 2019-04-16. postgres=# explain select * from t1 where dt = current_date + 400; QUERY PLAN ------------------------------------------------------------ Append (cost=0.00..198.42 rows=44 width=8) Subplans Removed: 3 -> Seq Scan on t1_1 (cost=0.00..49.55 rows=11 width=8) Filter: (dt = (CURRENT_DATE + 400)) (4 rows) postgres=# explain analyze select * from t1 where dt = current_date + 400; QUERY PLAN --------------------------------------------------------------------------------------- Append (cost=0.00..198.42 rows=44 width=8) (actual time=0.000..0.001 rows=0 loops=1) Subplans Removed: 3 -> Seq Scan on t1_1 (cost=0.00..49.55 rows=11 width=8) (never executed) Filter: (dt = (CURRENT_DATE + 400)) Planning Time: 0.400 ms Execution Time: 0.070 ms (6 rows) ---- I realized t1_1 was not scanned actually since "never executed" was displayed in the plan using EXPLAIN ANALYZE. But I think "One-Time Filter: false" and "Subplans Removed: ALL" or something like that should be displayed instead. What do you think? Best regards, Yuzuko Hosoya NTT Open Source Software Center