Skip to content

feat (ai-optimizer) : Implement PostgreSQL EXPLAIN plan collection pipeline - #95

Open
sarthaksarthak9 wants to merge 1 commit into
BNLNPPS:mainfrom
sarthaksarthak9:feat/explain-collector-plain
Open

feat (ai-optimizer) : Implement PostgreSQL EXPLAIN plan collection pipeline#95
sarthaksarthak9 wants to merge 1 commit into
BNLNPPS:mainfrom
sarthaksarthak9:feat/explain-collector-plain

Conversation

@sarthaksarthak9

Copy link
Copy Markdown

Description

This PR introduces the initial implementation of the EXPLAIN plan collection pipeline for the AI-assisted PostgreSQL query optimization framework.

The collector identifies slow query candidates from pg_stat_statements, captures execution plans using EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON), and persists the collected plans and metadata in the ai_optimizer schema for downstream analysis and recommendation generation.

To minimize impact on production workloads, the collector is designed to operate against a PostgreSQL read replica and supports configurable execution thresholds and collection intervals.

Collection workflow

  • Retrieves candidate queries from pg_stat_statements
  • Filters candidates using configurable thresholds
  • Executes EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON)
  • Captures execution plans and collection metadata
  • Records collection errors for troubleshooting

Notes

  • Recommendation generation, validation workflows, and API integration will be implemented in subsequent phases.
  • Runtime verification of the management command was not possible in the current environment because the required Django dependencies are unavailable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant