Database

Dealing with giant tables in Postgres using Partitioning

Operation towards very large tables takes too much time in database. To overcome this problem, Postgres introduced partitioning using pg_partman extension.

Steps to implement

1. Install extension
CREATE EXTENSION pg_partman;
2. Create table
CREATE TABLE events;
3. Create parent index table
SELECT create_parent('public.events', 'created_at', 'time', 'daily');
4. Run partitioning
SELECT run_maintenance();

Reference

https://blog.heroku.com/handling-very-large-tables-in-postgres-using-partitioning

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *