Skip to content

Implement V$SQL_PLAN/DBA_HIST_SQL_PLAN analysis for missing index detection#24

Draft
Copilot wants to merge 4 commits intodevfrom
copilot/yodelling-eel
Draft

Implement V$SQL_PLAN/DBA_HIST_SQL_PLAN analysis for missing index detection#24
Copilot wants to merge 4 commits intodevfrom
copilot/yodelling-eel

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 27, 2025

The checkForMissingIndexes method was disabled due to fundamentally incorrect SQL logic (wrong joins, no time filters, improper aggregation). Reimplemented using proper Oracle execution plan analysis.

Changes

Core Implementation

  • Query V$SQL_PLAN for current full table scans with filter predicates
  • Fallback to DBA_HIST_SQL_PLAN for historical AWR data (7-day window)
  • Join with USER_IND_COLUMNS to exclude already-indexed columns
  • Filter by MIN_ACCESS_COUNT threshold and aggregate by sql_id/object_name

New Helper Methods

  • extractColumnsFromFilterPredicates() - Parses Oracle's quoted column format from predicates
  • isColumnIndexed() - Validates column index status before recommending
  • calculateMissingIndexUtility() - Log-scaled utility score based on execution count × elapsed time

Metrics

  • oracle.index.missing_index_candidate (table, columns tags)
  • oracle.index.full_table_scan_executions (table tag)

Example Output

When a missing index candidate is detected:

Missing index candidate: ORDERS on columns STATUS, CREATED_DATE (executions: 1000, utility: 65.2%)

Persisted to audit_index_analysis with action ADD and suggested index DDL in rationale.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.example.com
    • Triggering command: /opt/oracle/product/23ai/dbhomeFree/bin/oracle oracleFREE (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq))) (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Work on TODO: Reimplement with proper SQL using V$SQL_PLAN/DBA_HIST_SQL_PLAN analysis (from src/main/java/com/rcs/ssf/metrics/IndexEffectivenessAnalyzer.java)

Created from VS Code via the GitHub Pull Request extension.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 27, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel
Copy link
Copy Markdown

vercel bot commented Nov 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
spring-graphql Ready Ready Preview Comment Nov 27, 2025 4:35pm

…ndex analysis

Co-authored-by: zlovtnik <8680798+zlovtnik@users.noreply.github.com>
Co-authored-by: zlovtnik <8680798+zlovtnik@users.noreply.github.com>
Co-authored-by: zlovtnik <8680798+zlovtnik@users.noreply.github.com>
Copilot AI changed the title [WIP] Reimplement SQL using V$SQL_PLAN and DBA_HIST_SQL_PLAN analysis Implement V$SQL_PLAN/DBA_HIST_SQL_PLAN analysis for missing index detection Nov 27, 2025
Copilot AI requested a review from zlovtnik November 27, 2025 16:35
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.

2 participants