Improving Query Performance in PostgreSQL
Amy McCarty
Instructor
SELECT *
FROM ...
Describe | organized storage |
Contains | data |
Loaded | extract, transform, load (ETL) process |
Source | human resources program, client management system, survey collection, etc. |
Describe | organized (row and column) storage |
Contains | data |
Loaded | query (transient) |
Source | existing base tables |
CREATE TEMP TABLE my_temptable AS
SELECT *
FROM survey_monkey_results
WHERE survey_date >= '2019-01-01';
SELECT * FROM my_temptable
Describe | stored query |
Contains | directions / view definition |
Loaded | never |
Source | existing base tables |
View utility
Describe | stored query | view |
Contains | data | table |
Loaded | refresh process | table |
Source | existing base tables | view |
Materialized view utility
What | Why |
---|---|
Table | base storage |
Temp table | speeds query using big table |
View | complicated logic or calculated fields |
Materialized view | complicated logic that slows performance |
SELECT table_type
FROM information_schema.tables
WHERE table_catalog = 'orders_schema'
AND table_name = 'customer_table'
Improving Query Performance in PostgreSQL