5 ms·
Great introduction to partitions. I did not know how exactly they are used. And now I think that I do. Thank you! What I noticed (some improvement suggestions)
by goldmar 12y ago
Great introduction to partitions. I did not know how exactly they are used. And now I think that I do. Thank you!
What I noticed (some improvement suggestions):
1)
"the planner could tell (using knowledge from the check constraint) that employees_1 was the only table it needed to look at."
Well, I think it still checks the parent table, right?
2)
You could mention that it is possible to create a trigger function which inserts new data automatically into the correct child table (as described in your final link, here: http://www.postgresql.org/docs/9.3/static/ddl-partitioning.html http://www.postgresql.org/docs/9.3/static/ddl-partitioning.h...).
I think it would be cool if PostgreSQL could create these trigger functions automatically based on the check constraints...
I'm also wondering why foreign key constraints are not inherited?
- keithgabryelski 12y agoyes, the parent is also a target table -- but for partitioning you never put anything in the parent. I could probably talk about the troubles of putting data in the parent table. and yes, a trigger function is possible -- and I could have mentioned it (although this was written as an explanation of partitioning using the gem I created). I should mention the alternatives and why they weren't employed.