Optimize the most resource-consuming SQL queries

The approach: analyze pg_stat_statements, order by total_time, go from top to bottom and optimize Top-N queries.

Reports K001, K002, K003 generated by postgres-checkup tool help to see the picture.

It's worth to start this process from the master node first and then proceeding to replicas. The final goal is decreasing resource consumption and, as a result, prepare better for the future growth.

Fresh checkups:

Issues opened:

MASTER:

REPLICAS:

Edited by Nikolay Samokhvalov