I have a large table (table_A) in PostgreSQL with the following characteristics:
- 51 columns
- 500 million records
- Approximate size: 200GB
I frequently perform CRUD operations, but these operations are limited to only 10 columns. The remaining 40 columns are rarely used and are mostly utilized for reporting purposes.
To improve performance, I am considering vertical partitioning by splitting the table into two parts:
table_A_main: Contains 11 columns (includinguniqueid, which serves as the primary key).table_A_details: Contains the remaining 41 columns (includinguniqueid, which is also the primary key).
To query the complete dataset, I would use a JOIN or create a VIEW:
SELECT *
FROM table_A_main
JOIN table_A_details
ON table_A_main.uniqueid = table_A_details.uniqueid;
CREATE OR REPLACE VIEW table_A AS
SELECT *
FROM table_A_main
JOIN table_A_details
ON table_A_main.uniqueid = table_A_details.uniqueid;
I am not able to use inheritance because I have already implemented partitioning. Are there better alternatives or optimizations for vertically partitioning a large table like this?
Any advice, best practices, or additional considerations would be greatly appreciated!
UPDATEperformance as you only have to read 1/5 of what you reading now, mean less I/O and efficient shared buffers usage.