pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Soni <diptatapa@gmail.com>
To: pgsql-general@postgresql.org
Subject: PG10 declarative partitioning that allow null value
Date: Tue, 16 Apr 2019 09:37:59 +0700
Message-ID: <41964f36-ae96-f37c-edde-bcea231617b3@gmail.com> (raw)

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.






view thread (3+ messages)  latest in thread

Message-ID: <41964f36-ae96-f37c-edde-bcea231617b3@gmail.com>
Permalink:  ../41964f36-ae96-f37c-edde-bcea231617b3@gmail.com/
Also on:    postgresql.org/message-id/41964f36-ae96-f37c-edde-bcea231617b3@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: diptatapa@gmail.com
  Subject: Re: PG10 declarative partitioning that allow null value
  In-Reply-To: <41964f36-ae96-f37c-edde-bcea231617b3@gmail.com>
  References: <41964f36-ae96-f37c-edde-bcea231617b3@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox