Here is the exercise to get comfort with partitioning. We will be using range partitioning.
Use retail database. Make sure orders table already exists.
You can reset the database by running these commands.
Connect to retail database.
psql -U itversity_retail_user
DROP TABLE IF EXISTS order_items;
DROP TABLE IF EXISTS orders;
DROP TABLE IF EXISTS customers;
DROP TABLE IF EXISTS products;
DROP TABLE IF EXISTS categories;
DROP TABLE IF EXISTS departments;
Create table orders_part with the same columns as orders.
Let us load and validate data in the partitioned table.
Load the data from orders into orders_part.
Get count on orders_part as well as all the 14 partitions. You should get 0 for default partition and all the records should be distributed using the other 13 partitions.