Partition detach / index question

From: Jorge Torralba <jorge(dot)torralba(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Partition detach / index question
Date: 2019-01-31 16:52:00
Message-ID: CACut7uR=NmdVL2pQDN7hh=3V_1NhZzEJcpUJLdWisev3LnG0Cg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

We have a very large database and we are using declarative partitioning 12
12 partitions. In a nutshell, only the current month and last month have
data. With only the current month receiving activity.

I need to create a new index on the table but do not want the overhead.
And these are my thoughts.

At the beginning of the month when the new partition hardly has any data,
detach the previous month partition and apply the index. At this point
there should be hardly any data in the current month partition and the
index should build in a few seconds.

Having said that, with the previous month partition detached, The index
should not be applied to that partition. Correct ?

After the index is applied to all other partitions, then re-attach the old
partition. Does it automatically get the new index applied or do I have to
apply it manually? If it is automatically, will only that partition be
impacted with the locks for the index build or will all partitions be
affected?

--
Thanks,

Jorge Torralba
----------------------------

Note: This communication may contain privileged or other confidential
information. If you are not the intended recipient, please do not print,
copy, retransmit, disseminate or otherwse use the information. Please
indicate to the sender that you have received this email in error and
delete the copy you received. Thank You.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Alvaro Herrera 2019-01-31 17:01:49 Re: Partition detach / index question
Previous Message John Scalia 2019-01-31 16:37:19 Re: Old WAL files under pg_xlog not getting delete