Explain why a slow query scans every row of its table, identify the column an index would target, and show the resulting write-cost tradeoff.
You are a database instructor who never recommends "just add an index" without first showing what the query is doing without one, because a student who hasn't seen the actual full table scan an unindexed query performs has no real basis for understanding why the index helps or when it wouldn't. My table, described as a list of columns with a rough sense of how many rows it holds, is: [TABLE_DESIGN] My query, the actual slow or frequently run query against it, is: [QUERY] If I left either blank, ask me to describe the table and paste the query before doing anything else instead of inventing an example table and query in their place. Explain what happens when [QUERY] runs against [TABLE_DESIGN] with no index present, the database checking every single row one at a time against the query's condition, called a full table scan, and state how that cost grows as the table's row count grows, roughly proportional to the total number of rows regardless of how few actually match. Then identify exactly which column or columns in [QUERY] an index would target, the ones appearing in a `WHERE` condition, a `JOIN`, or an `ORDER BY`, and explain in plain language how an index restructures that column's values into a form, commonly a B-tree, that can be searched by jumping toward the answer instead of checking every row, similar to using a book's index to jump to a page instead of reading the whole book front to back. Give the actual SQL statement to create that index. Then explain the tradeoff plainly: every `INSERT`, `UPDATE`, or `DELETE` touching the indexed column now also has to update the index itself, so a table indexed for fast reads becomes slightly slower to write to, and state whether that tradeoff is worth it for [TABLE_DESIGN] specifically, based on whether it sounds more read-heavy or write-heavy from what I described. My depth is [DEPTH:select:just this one query,also explain when adding an index would NOT help]. If I chose the second option, name one realistic case where adding an index to [TABLE_DESIGN] would not meaningfully help, such as a column with very few distinct values where the index barely narrows anything down, or a table so small that a full scan is already fast enough that the write-cost tradeoff isn't worth paying. Close by asking whether I have a second query against the same table with a different `WHERE` or `JOIN` column, since composite indexing decisions across multiple queries on the same table are usually where indexing choices get harder than a single query in isolation suggests.
Use this prompt anywhere
10,000+ expert prompts for ChatGPT, Claude, Gemini, and wherever you use AI.
Get Early AccessJust add an index is advice with nothing underneath it until someone has actually seen what a query does without one, checking every single row one at a time against the condition, called a full table scan, with cost growing roughly in proportion to the table's total row count no matter how few rows actually match.
This tool takes your real [QUERY] against your described [TABLE_DESIGN] and shows that scan happening first, then identifies which column the query's WHERE, JOIN, or ORDER BY touches, explains how an index restructures that column, commonly into a B-tree, so it can be searched by jumping toward the answer instead of checking every row, the way a book's index lets you jump to a page, and gives the actual SQL statement to create it.
It also states the real tradeoff plainly, every write touching that column now has to update the index too, so reads get faster while writes get slightly slower, judged against whether your table sounds read-heavy or write-heavy. Set [DEPTH] to also learn when an index would not help. Run it in the Dock Editor for a set of queries indexed, pair with the sql query explainer for how your query gets processed, or the big o complexity explainer for the underlying scan-versus-lookup math.
Set [TABLE_DESIGN] to your table's columns and rough row count, and [QUERY] to the actual slow or frequent query running against it.
Get a clear explanation of what your query does with no index present, checking every row and why that cost grows with table size.
See exactly which column your query's WHERE, JOIN, or ORDER BY clause touches, the one an index would actually target.
Get the real SQL statement to create the index, plus a plain-language explanation of how it restructures the column for fast lookup.
See why every write to the indexed column now also updates the index, and whether that tradeoff is worth it for your specific table.
See the full table scan an unindexed query performs before ever adding an index, so the benefit is observed instead of taken on faith.
Paste your actual slow query and table, and get the specific column and index statement that would target the real cause instead of guessing.
Review how a B-tree index restructures a column for fast lookup and the write-cost tradeoff that comes with it, tied to a concrete query example.
Check a low-value case, a low-cardinality column or a small table, against the specific reasons an index might not be worth its write cost there.
Discover more prompts that could help with your workflow.
Build a small working program that calls a real public API, with the request, response, and API key setup explained step by step.
Explain a core functional programming idea, such as pure functions or immutability, with a broken code example and its fixed version shown side by side.
Explain a built-in math function, square root, power, absolute value, or rounding, covering math and syntax, then generate practice calls to predict before revealing results.
10,000+ expert-curated prompts for ChatGPT, Claude, Gemini, and wherever you use AI. Our extension helps any prompt deliver better results.