Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxT1L-00049x-PA for pgsql-committers@arkaria.postgresql.org; Thu, 28 Sep 2017 07:14:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dxT1L-0008Ha-5T for pgsql-committers@arkaria.postgresql.org; Thu, 28 Sep 2017 07:14: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_2) (envelope-from ) id 1dxT1K-0008FE-9U for pgsql-committers@postgresql.org; Thu, 28 Sep 2017 07:14:06 +0000 Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dxT1D-0002MB-TJ for pgsql-committers@postgresql.org; Thu, 28 Sep 2017 07:14:05 +0000 Received: by mail-wr0-x229.google.com with SMTP id z39so959472wrb.8 for ; Thu, 28 Sep 2017 00:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=B5hPzo/dXEqWWbi0jqjoB67PFi2SNt06r/khSfeyEyU=; b=rCEWrRQhddVxLbzq9HBTUv8N/HFgBXqunuYw5Nk4zFHPLROG19O2DZuxyHYlfBt8sW 7eKniIep3CtZD5AlG4FUJ6RHu0av+wIOWFNTNg5rlk0SLMDbMirUzvJmUFOe0G/ln8lV TArtGamMmZC9ZFe/8v+f4LOhWeU1+vMXCRPFEvuukH+Zt3do2qCVaeQl4AYQvLc+iWf+ 5qMIE4v2K+yWbjlbHIvn1oMHjm2KZ1NM7lJs/J5nENXPBIqGA6FrktD8xbNFTsyq6V2o 11tTk5eAaicWK5D1UtV10oEsJpEG3KQX47z7saxiIsyl2D0P75IQULgRDRVJ1rD/Jh/Z Pwyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=B5hPzo/dXEqWWbi0jqjoB67PFi2SNt06r/khSfeyEyU=; b=kqdMtHe/6fs2nN3ZVAd3CmHFG4bge/9iydQKREZu2LzgUdmDFLlHZhp/Ed3nwvvEzW MwqVO7uh6j/fD0X4/C0xaeUegj4UJEXoN/gpp3E6IoBdR3CCUiDHoeWG1SDAB/s3EJZk RZ81Q5wkrRTKgSMaseepTr5vRpICnr6r4KlvOi23pvczxgIgR2d76UwNK1Sw7kc9bT7M juZePz3ysC/YiK6oR0lM0/2/nU1JHRH2LxxDz1ZFJJWY4145CGmhXJeVFUqQMimRT3tZ LUplGS2MsV0a5MMUaW/XwgQHCHTQQE7PrzpjHq+07mQZSQzXDdOfn9+jTXzsRTE+4AKD zPGA== X-Gm-Message-State: AHPjjUg2FPrUoiJhVnjyAfzdvx5kGMcrgafEdikRIT3lAkkDlo/QZMiH uPloV32YWa6V2AAOq3GQYwYyDGXeo1eNJXAxYtSOgA== X-Google-Smtp-Source: AOwi7QCKlgG+szWqSnUUwl4lbkQ+Y6/j66aL/mN8LTb4taF31uEuiuwQnW6BQGfEjPkM59/n4w6BCUW/ppqMRp68e98= X-Received: by 10.223.199.196 with SMTP id y4mr3958586wrg.181.1506582838847; Thu, 28 Sep 2017 00:13:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.173.40 with HTTP; Thu, 28 Sep 2017 00:13:58 -0700 (PDT) In-Reply-To: <571d159d-ca5e-ab0a-1bbf-2cef66ba0e42@lab.ntt.co.jp> References: <571d159d-ca5e-ab0a-1bbf-2cef66ba0e42@lab.ntt.co.jp> From: Ashutosh Bapat Date: Thu, 28 Sep 2017 12:43:58 +0530 Message-ID: Subject: Re: [HACKERS] PartitionSchemaData & partcollation (Re: pgsql: Associate partitioning information with each RelOptInfo.) To: Amit Langote Cc: Robert Haas , pgsql-committers@postgresql.org, Pg Hackers Content-Type: text/plain; charset="UTF-8" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org On Thu, Sep 28, 2017 at 11:47 AM, Amit Langote wrote: > On 2017/09/21 12:42, Robert Haas wrote: >> Associate partitioning information with each RelOptInfo. >> >> This is not used for anything yet, but it is necessary infrastructure >> for partition-wise join and for partition pruning without constraint >> exclusion. >> >> Ashutosh Bapat, reviewed by Amit Langote and with quite a few changes, >> mostly cosmetic, by me. Additional review and testing of this patch >> series by Antonin Houska, Amit Khandekar, Rafia Sabih, Rajkumar >> Raghuwanshi, Thomas Munro, and Dilip Kumar. > > I noticed that this commit does not add partcollation field to > PartitionSchemeData, while it adds parttypcoll. I think it'd be necessary > to have partcollation too, because partitioning would have used the same, > not parttypcoll. For, example see the following code in > partition_rbound_datum_cmp: > > cmpval = DatumGetInt32(FunctionCall2Coll(&key->partsupfunc[i], > key->partcollation[i], > rb_datums[i], > tuple_datums[i])); > > So, it would be wrong to use parttypcoll, if we are to use the collation > to match a clause with the partition bounds when doing partition-pruning. > Concretely, a clause's inputcollid should match partcollation for the > corresponding column, not the column's parttypcoll. > > Attached is a patch that adds the same. I first thought of including it > in the partition-pruning patch set [1], but thought we could independently > fix this. > I think PartitionSchemeData structure will grow as we need more information about partition key for various things. E.g. partsupfunc is not part of this structure right now, but it would be required to compare partition bound datums. Similarly partcollation. Please add this to partition pruning patchset. May be parttypcoll won't be used at all and we may want to remove it altogether. -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers