PostgreSQL Features to Try
Starting with version 10, PostgreSQL natively supports sharding of a table into multiple child tables, based on a partition key value computed from one or more column values. You can query and insert at the parent level, and PostgreSQL will route it to the appropriate child table, have a look:
First, we insert two rows:
We can see that the rows are actually inserted into the child tables:
But queries can be done on the parent, returning combined result:
Partitioning is in some ways similar to inheritance (query at parent level), but there are differences too (partition parent contains no data, for example). Here is a table that uses an array column:
Assuming each row represents a blog post, each having a set of tags, here is how we can list all the posts that have both “postgres” and “go” tags:
The usage of the array type here makes for concise data modelling and simpler queries.
Source: pgdash.io