Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres Queries Statistics and Indexes Monitoring #4324

Open
9 tasks
andrewsignori-aot opened this issue Feb 6, 2025 · 0 comments
Open
9 tasks

Postgres Queries Statistics and Indexes Monitoring #4324

andrewsignori-aot opened this issue Feb 6, 2025 · 0 comments
Labels
Dev & Architecture Development and Architecture

Comments

@andrewsignori-aot
Copy link
Collaborator

andrewsignori-aot commented Feb 6, 2025

As we are increasing the database load on PROD, we should monitor query execution to determine the most expensive ones and find opportunities to create indexes or change queries in a way that takes advantage of exciting indexes.

  • Check how to monitor queries on Postgres to track statistics of SQL planning and execution
    • Check if pg_stat_statements extension is available and can be used to track statistics of SQL planning and execution. Please see below a possible example to identify some queries.
SELECT query,
       total_exec_time,
       calls,
       mean_exec_time
FROM pg_stat_statements
ORDER BY total_exec_time DESC;
  • Check how they determine the most executed and most expensive queries.
  • Create a process to execute this analysis from time to time.
  • Check how to detect Fragmentation and address it.
    • Check if extensions like pgstattuple are available or if there are other similar ones.
    • Create a plan to verify and address possible fragmentation issues.
      • Some examples of commands would be VACUUM, REINDEX, and others.
  • Check with the Government community if there are solutions already in place to achieve the same.
@andrewsignori-aot andrewsignori-aot added the Dev & Architecture Development and Architecture label Feb 6, 2025
@andrewsignori-aot andrewsignori-aot changed the title Postgres Queries Statistics and Monitoring Postgres Queries Statistics and Indexes Monitoring Feb 6, 2025
@ninosamson ninosamson added Business Items under Business Consideration and removed Dev & Architecture Development and Architecture labels Feb 6, 2025
@CarlyCotton CarlyCotton added this to the Full-Time Students MVP milestone Feb 6, 2025
@ninosamson ninosamson added Dev & Architecture Development and Architecture and removed Business Items under Business Consideration labels Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dev & Architecture Development and Architecture
Projects
None yet
Development

No branches or pull requests

3 participants