Text & chat prompt

Speed up a slow SQL query

Speed up a slow SQL query: a free, copy-paste prompt for ChatGPT, Gemini and Claude. Paste the prompt and replace each [BRACKETED] field with your own details.

The prompt

Help me optimise this slow SQL query.

Database: [POSTGRES / MYSQL / SQL SERVER]
Query: [PASTE]
Table sizes: [ROW COUNTS]
Existing indexes: [LIST]

Explain why it is slow, suggest indexes and a rewritten query, and tell me what to look for in EXPLAIN output. Warn me about any change that could alter the results.

Pro tip: Paste the EXPLAIN ANALYZE output if you can. It removes the guesswork.

How to use this prompt

  1. Open ChatGPT and start a new chat.
  2. Paste the prompt.
  3. Replace each [BRACKETED] field with your real details and paste in your own text where asked.
  4. Reply with follow-ups such as "make it shorter" or "make it sound more like me".

Prompt at a glance

Category
Text & chat
Works with
ChatGPT · Gemini · Claude
Length
54 words
Fields to fill in
POSTGRES / MYSQL / SQL SERVER, PASTE, ROW COUNTS, LIST
Last updated

Frequently asked questions

Which AI tools work with this prompt?

It is written for ChatGPT, Gemini and Claude. Paste it into your preferred tool and adjust the wording if the result is off.

What do I need to fill in?

Replace these fields before you send it: POSTGRES / MYSQL / SQL SERVER, PASTE, ROW COUNTS, LIST. Each field shows an example in the prompt.

Should I paste private information into the prompt?

Only what the task needs. Remove names, contact details and other sensitive data before pasting a resume or document into any AI tool.

More chat & writing prompts

See all 373 chat & writing prompts →