I have a Django 1.7 project that uses Postgres 9.3. I have a table that will have rather high volume. The table will have anywhere from 13million to 40million new rows a month.
I would like to know what the best way to incorporate Postgres table partitioning with Django?
PostgreSQL supports basic table partitioning. This section describes why and how to implement partitioning as part of your database design.
You can use the ALTER TABLE… ADD PARTITION statement to add a partition to a table with a DEFAULT rule as long as there are no conflicting values between existing rows in the table and the values of the partition to be added.
Table partitioning is one of the best-liked features out of the more recent PostgreSQL developments. However, there is no support for automatic partition creation yet.
If you are using newer version of PostgreSQL, you can try this
https://github.com/chaitin/django-pg-timepart
A Django extension that implements PostgreSQL tables for partitioning and management based on dates.
You can use Architect application for Postgresql Table Partitioning Django Project
PostgreSQL’s partitioning implementation in Architect is done purely at the database level. That means that Architect creates several triggers and functions and inserts them directly into the database, so even if you issue direct insert statement from database console and not from the ORM, everything will work as expected and record will be inserted into the correct partition, if partition doesn’t exist, it will be created for you automatically. Also partitions may be created in any order and not only from lower to higher.
It's new version of old Django DB Parti application
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With