Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f4muo-0004BD-71 for pgsql-hackers@arkaria.postgresql.org; Sat, 07 Apr 2018 12:25:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f4mul-0005Zj-Sw for pgsql-hackers@arkaria.postgresql.org; Sat, 07 Apr 2018 12:25:51 +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.89) (envelope-from ) id 1f4msz-0008SF-Fr for pgsql-hackers@lists.postgresql.org; Sat, 07 Apr 2018 12:24:02 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f4mst-0004nO-Df for pgsql-hackers@postgresql.org; Sat, 07 Apr 2018 12:24:00 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id B329B1231; Sat, 7 Apr 2018 08:23:52 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 07 Apr 2018 08:23:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=pKm7IlzoxnTufJprv VdLPuO1hHNz35gCsvJo7QpPJdU=; b=DNHoksHLy7xOVpDuQh2zujl4kWmf3yNfB C2KX15hNGd43Waf44XmTJZ2K++SH28QcLmRMr3B8kT7kqaiKGQXtTF/Aw8L8oeuJ pogwffzCTDGDxSBqWuOVHmRVzrXz8mAdm9yVt/D+A/L71nuqfQYldjkcbHChL9uM La0pCUh2h/zTESwlAea1F3TS3zV4T/HP/v+U03pF1HUmIW6QSK1yDdHq4sFdqsCY 1U2+5U0uFU93j3T6FE7D9G5yT40hSsuw8eDywLLa+QODRI/TPayfIyutAi9HDQme ev4Hn69vnJeuod9YchxPKvsecPEeHT4ouOB+x6j09qsjuM2ONeZ+A== X-ME-Sender: Received: from alvin.alvh.no-ip.org (unknown [179.56.51.182]) by mail.messagingengine.com (Postfix) with ESMTPA id 9D0AF1025C; Sat, 7 Apr 2018 08:23:51 -0400 (EDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id BC96433C; Sat, 7 Apr 2018 09:23:49 -0300 (-03) Date: Sat, 7 Apr 2018 09:23:49 -0300 From: Alvaro Herrera To: Amit Langote Cc: Andres Freund , David Rowley , Amit Langote , Jesper Pedersen , Rajkumar Raghuwanshi , Beena Emerson , Robert Haas , amul sul , "pgsql-hackers@postgresql.org" , Dilip Kumar Subject: Re: [HACKERS] Runtime Partition Pruning Message-ID: <20180407122349.6ngjpkf67zs3vmnd@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="j5yv2bwgqysyw2vm" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --j5yv2bwgqysyw2vm Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Amit Langote wrote: > See if the attached makes it any better. > > Now I know we don't have the runtime pruning in yet, but since the > proposed patch would extend its functionality I have included its > description in the comment. Thanks! I edited it as attached, to 1. avoid mentioning functionality that doesn't yet exist, and 2. avoid excessive internal detail (we want a high-level overview here), which from experience gets outdated pretty quickly. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services --j5yv2bwgqysyw2vm Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="expand-partprune-header-comment-2.patch" Content-Transfer-Encoding: quoted-printable commit 28768290d8d9c58e76e2594a14d5b1f8465ba262=1B[m Author: Alvaro Herrera AuthorDate: Sat Apr 7 08:44:12 2018 -0300 CommitDate: Sat Apr 7 09:20:58 2018 -0300 Add some documentation to partprune.c =20 Author: Amit Langote Discussion: https://postgr.es/m/CA+HiwqGzq4D6z=3D8R0AP+XhbTFCQ-4Ct+t2ek= qjE9Fpm84_JUGg@mail.gmail.com diff --git a/src/backend/partitioning/partprune.c b/src/backend/partitionin= g/partprune.c index 959ee1643d..07b8057e3f 100644 --- a/src/backend/partitioning/partprune.c +++ b/src/backend/partitioning/partprune.c @@ -1,10 +1,27 @@ /*------------------------------------------------------------------------- * * partprune.c - * Parses clauses attempting to match them up to partition keys of a - * given relation and generates a set of "pruning steps", which can be - * later "executed" either from the planner or the executor to determine - * the minimum set of partitions which match the given clauses. + * Support for partition pruning during query planning + * + * This module implements partition pruning using the information containe= d in + * table's partition descriptor and query clauses. + * + * During planning, clauses that can be matched to the table's partition k= ey + * are turned into a set of "pruning steps", which are then executed to + * produce a set of RTIs of partitions whose bounds satisfy the constraint= s in + * the step. Partitions not in the set are said to have been pruned. + * + * There are two kinds of pruning steps: a "base" pruning step, which cont= ains + * information extracted from one or more clauses that are matched to the + * (possibly multi-column) partition key, such as the expressions whose va= lues + * to match against partition bounds and operator strategy to associate to + * each expression. The other kind is a "combine" pruning step, which com= bines + * the outputs of some other steps using the appropriate combination metho= d. + * All steps that are constructed are executed in succession such that for= any + * "combine" step, all of the steps whose output it depends on are executed + * first and their ouput preserved. + * + * See gen_partprune_steps_internal() for more details on step generation. * * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California --j5yv2bwgqysyw2vm--