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 1hePlv-0000N6-1I for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Jun 2019 20:04:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hePku-0005gD-6t for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Jun 2019 20:03:28 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hePkt-0005g0-Nz for pgsql-hackers@lists.postgresql.org; Fri, 21 Jun 2019 20:03:27 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hePkl-0006mf-In for pgsql-hackers@lists.postgresql.org; Fri, 21 Jun 2019 20:03:26 +0000 Received: by mail-qt1-x844.google.com with SMTP id p15so8209216qtl.3 for ; Fri, 21 Jun 2019 13:03:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=/2oM6YfMjScuNkPRiffpG8fRYDQsDb2dNiYO3BY/vng=; b=iwRR5kNTOsxu1B98RAL4IctQcqDqqqqxxIOFB/y6aRQqHtUBQWM8e1kJLGxd3DFn6a DwGwScXe9XJRzRtZ5L4g3yYL0MTXzp+NJrQ9w4AotJ18cxi2RFstt8MVmA0o0fbQMUip DimC2mWPKKb94mMQ85W5e7WT8jPyGat4Cdh83scycE/+oh9lQxuzvj7seiLHKjwNtLoB C3Bq7tSfirdCFM/KEfyxA7cyTpbyJbUpkxlKDJh+mQy7+hiMxGStGi1SOzADzYIb9hyE MMhGA79rdrlvWLT5DeTo+HD9h31gM4p6y+PvEunQZvqlK5rZlM13lMiGn54K0S/wndvU G9yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=/2oM6YfMjScuNkPRiffpG8fRYDQsDb2dNiYO3BY/vng=; b=XM12kF6LLUV821Niq0m4hV+fxw+w/my2TQ2CHPft+chxB8SKK1JzfAlF44kZxy2fI/ w/eF0L46/fm4iptvJu9dXTB9prL0+Eu6ulxPMe6e/fmkKh+te3HXWvzWMyFROwa9dsg+ 0+lctmP8tLdcv/0TU4PudDQb1RVRaNV5H1W7KSZl9vU8XgJwfwYrq+4AukLsqN/kpKEp iJx+NTvIuYE4cnzjq0ekyr7MZP8OILqCyqSxm/IVe2OZMGDuYYT3e0Z8kEyb61ZoNO+c hdnzine3N2nZJemRbiJtfBAoHQPh2E2ZwXssn/+VNj3plDejCubM2jw4Ywq2MFkzzjcG XULg== X-Gm-Message-State: APjAAAWi8bGIJFliRwY6IsDKZN+stlhyhsQyjVL1Dv9wWasYt+lnCe8A As3+wQNS3HAtzsMIpMbjqd198A== X-Google-Smtp-Source: APXvYqwtCyO83p/ZSWHHhMHuvB35jB0gLsxt1p3iJBXJAWOLefNsQE8oB9MAaHAJ/M4ujJH51eHsxg== X-Received: by 2002:ac8:2a99:: with SMTP id b25mr21453677qta.223.1561147396679; Fri, 21 Jun 2019 13:03:16 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id v75sm1932211qka.38.2019.06.21.13.03.15 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 21 Jun 2019 13:03:16 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 823A1120804; Fri, 21 Jun 2019 16:03:14 -0400 (-04) Date: Fri, 21 Jun 2019 16:03:14 -0400 From: Alvaro Herrera To: Shawn Wang Cc: pgsql-hackers@lists.postgresql.org, Yuzuko Hosoya Subject: Re: Problem with default partition pruning Message-ID: <20190621200314.GA20344@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <156074212109.1403.13115055299095638563.pgcf@coridan.postgresql.org> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Jun-17, Shawn Wang wrote: > I tested different types of key values, and multi-level partitioned tables, and found no problems. > Only the SQL in the file of src/test/regress/results/partition_prune.out has a space that caused the regression test to fail. It's not clear to me what patch were you reviewing. The latest patch I see in this thread, in [1], does not apply in any branches. As another test, I tried to apply the patch on commit 489e431ba56b (before Tom's partprune changes in mid May); if you use "patch -p1 --ignore-whitespace" it is accepted, but the failure case proposed at the start of the thread shows the same behavior (namely, that test1_def is scanned when it is not needed): 55432 12devel 23506=# create table test1(id int, val text) partition by range (id); create table test1_1 partition of test1 for values from (0) to (100); create table test1_2 partition of test1 for values from (150) to (200); create table test1_def partition of test1 default; explain select * from test1 where id > 0 and id < 30; CREATE TABLE Duración: 5,736 ms CREATE TABLE Duración: 5,622 ms CREATE TABLE Duración: 3,585 ms CREATE TABLE Duración: 3,828 ms QUERY PLAN ───────────────────────────────────────────────────────────────── Append (cost=0.00..58.16 rows=12 width=36) -> Seq Scan on test1_1 (cost=0.00..29.05 rows=6 width=36) Filter: ((id > 0) AND (id < 30)) -> Seq Scan on test1_def (cost=0.00..29.05 rows=6 width=36) Filter: ((id > 0) AND (id < 30)) (5 filas) Duración: 2,465 ms [1] https://postgr.es/m/00cf01d4eea7$afa43370$0eec9a50$@lab.ntt.co.jp -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services