Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

3.3 Rules of Thumb

Last Updated: September 29, 2024

Here are some useful ideas to keep in mind when creating your queries:

Pipelining. Pipelining is where you scan the first tuple and then decides to pass it along to the next stage (e.g., filter) instead of waiting for all the tuples to be scanned. This allows the scan, filter, and aggregator to work in parallel and decrease waiting time.

Periodic Reorganization. Because Postgres is relatively lazy when it comes to updating, we need to tell Postgres explicitly to update the statistics. VACUUM allows you to recompute statistics in one of two ways: 1) VACUUM ANALYZE; which applies to all tables or 2) VACUUM (FULL, ANALYZE) tablename; which will perform like VACUUM and reorganizes and moves around data.

There are also other settings that you can adjust to optimize performance. Check out the Postgres manual for more.