query-optimization skillA
query-optimization is agent-read markdown (skill) from nahid-sparktales/agent-dispatcher: Make one slow query fast without guessing — capture the plan, find where the time actually goes, change one thing, and measure again on comparable data. Use when a query, endpoint or report is slow and the database is the suspect, when a plan needs reading, or when someone proposes an index with no evidence. Not for modelling decisions about tables and constraints, not an engine feature reference, and not for system-wide performance work where the database has not yet been shown to be the bottle.
Indexed from public GitHub and served as immutable, content-addressed versions. Install it pinned to an exact SHA-256 with the mdr CLI, and every file is verified against the hash recorded here before it reaches your agent. The deterministic audit below grades the latest version, and the same file always earns the same grade.
What the file says
# Query optimization An index added on a hunch is a permanent write cost bought with no evidence. The work here is measurement: the plan before, one change, the plan after, on data that resembles the data that is actually slow. ## When this fires A specific statement is slow, or a plan needs interpreting, or a proposed index needs justifying. It does not fire before the database has been shown to be where the time goes — if that is still open, measure the request end to end first. It does not fire for redesigning the tables. ## Procedure 1. **Get the exact statement and its parameters.** Not "the dashboard is slow" — the SQL text as the database received it, with the bind values, and where it runs from. A statement-statistics view, the ORM's query log or the application log will have it. The parameters matter: the same query can take different plans for different values. 2. **Confirm the database is the bottleneck.** Compare the statement's own time against the total request time. If the query is 40ms of a 3s request, stop here and say so. Note whether the cost is one slow statement or many fast ones — an N+1 is fixed in the calling code, not by an index. …
Read the whole file at its exact version.
How to install
mdr add nahid-sparktales/agent-dispatcher/query-optimization@git:20260919.a0d4f55mdr add nahid-sparktales/agent-dispatcher/query-optimization@sha256:7c0784025e6fb182Pin to a label to follow the author's releases, or to a sha256 to freeze the exact bytes forever. Either way the resolved hash is written to mdr.lock, and mdr install reproduces it on any machine.
[](https://markdownregistry.com/a/art_2d5hqmfpii4rs77c)
1 badge views in 30 days
Versions
Audit of the latest version
- pass: Frontmatter block present
- pass: Frontmatter declares a name
- pass: Frontmatter declares a description
- pass: Size between 200 bytes and 200 KB (7227 bytes)
- pass: No zero-width or bidi control characters
- pass: No instruction hidden inside an HTML comment
- pass: No link to an exfiltration or paste host
- pass: No credential-shaped string
- pass: No instruction to send local credentials anywhere
- pass: No text hidden with inline styles
- pass: No prompt-injection phrasing
- pass: No curl or wget piped into a shell
- pass: No recursive delete of root, home or parent
- pass: No instruction to read or print local credentials
- pass: No base64 blob over 200 characters
- pass: No link to a raw IP address
- pass: No script tag
Source
nahid-sparktales/agent-dispatcher · 49 stars · license MIT · pushed 2026-09-23 · branch main
API
GET https://markdownregistry.com/api/v1/artifacts/art_2d5hqmfpii4rs77c GET https://markdownregistry.com/api/v1/resolve?ref=nahid-sparktales/agent-dispatcher/query-optimization GET https://markdownregistry.com/api/v1/blob/7c0784025e6fb18213ca57871eac6fc5c5f9e45626e1baa1b83d72d71aff88ac
Your agent does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
More from nahid-sparktales/agent-dispatcher
Every file in nahid-sparktales/agent-dispatcher