PostgreSQL partitioning explained
This is quite a good informal high-level explanation.A thing I can't understand is why this isn't made automatic.If there are 100 companies, you don't want to create 100 tables, then add 100 FOREIGN KEY constrains, and then again each time a new company appears, do you? Wouldn't a "syntactic sugar" like "PARTITION BY company_id" that does all this automatically be possible?Just asking if there is a reason something like this is not implemented.