Postgresql Table Partitioning Django Project -
i have django 1.7 project uses postgres 9.3. have table have rather high volume. table have anywhere 13million 40million new rows month.
i know best way incorporate postgres table partitioning django?
as long use inheritance, , connect parent table django model, partitions should entirely transparent django. is, select
on parent table cascade down partitions, unless only
keyword explicitly used (where applicable).
note partitioning add complexity in terms of needing implement programmatic method of determining when new partitions need created, , creating them -- or doing manually @ intervals. depending on exact data , business logic, quite may need implement triggers , rules determine partition to, say, insert
(since wouldn't want insert
parent table). these, too, should abstracted django, however.
i have found that, depending on exact circumstances, may need done main apps shutdown, lest new partition creation cause deadlock.
also worth considering whether need true partitions created on time, or if inheritance model of, say, tables foo
, foo_archive
suffice, foo_archive
inherits foo
, , periodically (e.g. script) moves older data foo_archive
keep foo
smaller.
Comments
Post a Comment