Table partitioning
Table partitioning is used to increase performance by physically arranging data in the hard disk based on a certain grouping criteria. There are two techniques for table partitioning:
- Vertical table partitioning: The table is divided into several tables in order to decrease the row size. This allows a faster sequential scan on divided tables as a relation page holds more rows. To explain, let's assume that we want to store pictures for each seller in the database to be used as their respective logos. One could model this by adding a column of the
bytea
orblob
type. The other approach is to have another table reference the sellers table, as follows:CREATE TABLE car_portal_app.seller_logo ( seller_id INT PRIMARY KEY REFERENCES car_portal_app.seller_account (seller_account_id), logo bytea NOT NULL );
- Horizontal table partitioning: This is used to decrease the whole table size by splitting the rows over multiple tables; it is supported by table inheritance and constraint...