O'Reilly logo

PostgreSQL Cookbook by Chitij Chauhan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Managing partitions

Here, we are going to show you how the partitioning scheme remains intact when an existing partition is dropped or a new partition is added.

Getting ready

Please refer to the first recipe, Implementing partitioning, before you read the steps outlined in this recipe.

How to do it...

There are two scenarios here. One scenario shows what happens when you delete an existing partition, and another shows what happens when a new partition is added. Let's discuss both the cases.

  • In the first scenario, we will drop an existing partition table. Here, the country_code_sa table will be dropped, as follows:
    1. Before dropping the country_log_sa child table, see the records in the country_log master table:
      postgres=# SELECT * from country_log; created_at ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required