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 1hGDz7-0006sT-VF for pgsql-general@arkaria.postgresql.org; Tue, 16 Apr 2019 02:38:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hGDz6-0005yM-D9 for pgsql-general@arkaria.postgresql.org; Tue, 16 Apr 2019 02:38:08 +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 1hGDz6-0005yD-1r for pgsql-general@lists.postgresql.org; Tue, 16 Apr 2019 02:38:08 +0000 Received: from mail-yw1-xc31.google.com ([2607:f8b0:4864:20::c31]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hGDz3-00081t-DR for pgsql-general@postgresql.org; Tue, 16 Apr 2019 02:38:07 +0000 Received: by mail-yw1-xc31.google.com with SMTP id p64so6781419ywg.7 for ; Mon, 15 Apr 2019 19:38:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=F5zJRZKp50uQ83taPQnyfbySWACN0kAvM+ubq6+UJ64=; b=dZI+sZY30SFTMF+RGJM/cDxgWVmrq4i8CGHtQeWQa46Cfn9RpKDeVQ/Jy7v/Y9fFyZ p+8BiJq+qb9d1Ks4GeKko1N03d9Xv26hdvYcoOCTXmEUhLMYeWZEivET4XSJ3hzOuLGo XnBsvgZ0KNbFDaOAftMVLOOFGH68OLpxoQkUSX9u1jpexlppH161I5qaxpK6JuUesjoi lYaxCnN+2XWbnyMmYEYPEElDBx9Ou2vXR3iYIHdRyk9qCauDPmfq1cFjt7ueJnf7A8xg qMjN988avAoflhVWc3Yh4RpXnD/FSYnrw1KyKlSR28rgpwIYSZrwy9PTkf4VbfolbIR1 5vjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=F5zJRZKp50uQ83taPQnyfbySWACN0kAvM+ubq6+UJ64=; b=EK18SLE5PfB7kSnOfrTSaMb1DzRfdlvQGRFxvGzK7SIPZPKJuzfTsPUd54U61xLLDj taOMaNWcly/Fyw/PyuJ4rLL5wUiVlB8bx2rGcZclrD380AQi4wS7LT0Q7lwG8Ke8EVqR tiHQ40JJOj2Atkk/i8hz5CxRevW6k4C8lTboM8BdFiPAJFLjaqd7MUOxdStuuFzjB+yu szeswbtIQ52cnS2ZC1uQ6uzdvFNHICFFV0IT2VzA1+KM5sSwa1MNuE3StICbxf2QEFXk FeI8eyVLq5rCqMH2hTNrg3tQXawVBP7j0EAL4gHEkqTf/5Gw4R1kTyZtQraEbXEHxvGL BS2A== X-Gm-Message-State: APjAAAVu/xSwg9UXng77A4ZxguhhTnqW3bJuZ+w/TRgEcyp91CICbTGm eQ6EpCtYJsrgNuQgT6PfllLzpPkm X-Google-Smtp-Source: APXvYqzH/W+GQRGxp3ASQ/MGaqs2BXcw3ko5egZpJhu1/PN/SwUWwgJdhEGTH8Uu6D6pgZq6G8fh8w== X-Received: by 2002:a0d:fec3:: with SMTP id o186mr59735340ywf.167.1555382282789; Mon, 15 Apr 2019 19:38:02 -0700 (PDT) Received: from [192.168.43.92] ([182.0.169.141]) by smtp.gmail.com with ESMTPSA id h204sm37210523ywh.110.2019.04.15.19.38.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Apr 2019 19:38:01 -0700 (PDT) To: pgsql-general@postgresql.org From: Soni Subject: PG10 declarative partitioning that allow null value Message-ID: <41964f36-ae96-f37c-edde-bcea231617b3@gmail.com> Date: Tue, 16 Apr 2019 09:37:59 +0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello All, currently we are planning to migrate inheritance partitioning to declarative partitioning by range values of int on pg10. But the key values can contain null. I know that range partitioning does not allow null values. We are looking for workaround for this, that is create a list partitioning and then followed by range sub-partitioning. List partitioning of number of digits of the int key column. CREATE TABLE partitioned_table_name (like table_name) partition by list (floor(log(int_key_column)+1)); create table partitions_1 partition of partitioned_table_name for values in (null); create table partitions_2 partition of partitioned_table_name for values in (1); ..... ..... create table partitions_2 partition of partitioned_table_name for values in (9) partition by range(int_key_column); Question is : is this a good practice ? will performance dropped significantly due to the process of counting the number of digits ? or is there any better workaround for this ? Thanks, Soni.