Since Postgres also supports partitioned tables, what is the use of child table.
Suppose there is a table of users which has a column created_date. We can store data in 2 ways:
- We create many child tables of this user table and distribute the data of users on the basis of
created_date(say, one table for every date, likeuser_jan01_21). - We can create a partitioned table with the partitioning key
created_date
Then what is the difference between these solution? Basically, I want to know what problem table inheritance can solve that partitioning cannot.
Another doubt I have: if I follow solution 1, and I query the user table without the ONLY keyword, will it scan all the child tables?
For example:
SELECT * FROM WHERE where created_date = current_date - 10;