Audit Your Database Indexes Against How the App Actually Queries It

    Updated

    How to use it

    Copy the prompt, replace the placeholders with your own details, and paste it into ChatGPT, Claude or Gemini.

    Save and favourite prompts with a free account.

    Tap any variable to replace it with your own value:

    AI prompt

    Audit a database's indexes against how the application actually queries it, not against generic best practices. I'll paste the table's current indexes: [paste index list/DDL] and the actual queries the app runs against it: [paste 3-6 representative real queries, ideally including any slow ones]. Produce: (1) which existing indexes are actually being used by these queries and which look unused or redundant (two indexes covering overlapping column sets, for instance); (2) which of the pasted queries has no supporting index at all and would benefit from a new one, with the exact index definition to add; (3) a warning on any index that helps reads but is expensive on writes, given how often this table gets written to: [describe write frequency]; (4) a specific, ordered list of what to add and what to consider dropping, not a generic 'index your foreign keys' lecture. If the queries given don't show enough to judge an index confidently, say so rather than guessing.

    Want to support this prompt?

    Share this prompt