pastesite.com New paste

Share an Explain Plan Without Your DSN

By · Published 2026-11-18 · reviewed 2026-11-13 · 3 min read

AI-assisted article. Reviewed by Codebuff automated editorial review on 2026-11-13. Examples are illustrative, not real user data.

A slow query is usually a plan problem, and the plan is the one artefact that answers the question without the data. The trouble is that plans almost never leave the database alone: they arrive wrapped in a client banner, a connection line and a timing footer, and that wrapper is where the server address, the database name and sometimes the user name live. Sharing the plan is right. Sharing the session around it is not necessary, and it is the part that leaks.

The plan is the part that answers the question

What a reader needs is the shape of the access path: which table was read first, whether the join used an index, how many rows the planner expected and how many it got. Everything else in the output is context, and context is exactly where credentials and topology hide.

If the plan is short, paste the plan. If the statement is long, paste the statement too, provided its literals are replaced. A plan without the query is often ambiguous, and a query without the plan leaves the reader guessing about the part you are asking about.

What the client prints around it

Most clients wrap the result in a header naming the server and the user, and many append a footer with the connection string. That wrapper is added by the tool, not the database, so removing it costs the reader nothing and removes the most sensitive line in the block.

Timing lines are worth keeping when they show planning time separately from execution time, because a plan that is fast to run but slow to plan is a different bug.

-- Before: the client header and footer travel with the plan
-- Connected to db-prod-07.internal as app_writer
EXPLAIN (ANALYZE, BUFFERS)
SELECT id, created_at FROM pastes WHERE owner_id = $1 ORDER BY created_at DESC LIMIT 50;
-- Time: 412.883 ms  Connection: postgres://app_writer@db-prod-07/pastes

-- After: the plan only, with the literal replaced
EXPLAIN (ANALYZE, BUFFERS)
SELECT id, created_at FROM pastes WHERE owner_id = $1 ORDER BY created_at DESC LIMIT 50;
-- Planning Time: 0.311 ms
-- Execution Time: 402.117 ms

Rewrite the identifiers, keep the shape

Rename the schema and the host if they are internal, but keep the table names that appear in the query, because the plan's node labels have to match the statement or the reader cannot follow it. Substituting every name with a letter makes the plan unreadable and is rarely necessary.

Replace literal values with placeholders. A plan's cost estimates do not depend on the literal being real, and a WHERE clause containing a customer's email address is the most common way a performance question turns into an incident report.

Say which engine and version produced it

Plan syntax is engine-specific and version-specific: the same statement prints very differently on MySQL 5.7 and 8.0, and PostgreSQL added plan options that older readers will not recognise. One line naming the engine, the version and the options used is more useful than any amount of prose about the server.

If you are asking for help, say what you expected as well. A plan with a sequential scan is not automatically wrong, and the person reading it can only tell you whether it is wrong for your data if they know what you assumed.

Sources and editorial review

Prepared with AI assistance and checked against the logs and plain-text sharing pages at the reviewed revision: the plan-versus-wrapper split, literal replacement, identifier guidance and the engine/version line. No specific database version is claimed, and the example timings are illustrative rather than measured.