Skip to content
>devspeak
← glossary
level 4Databases

Query

also: queries, queried, querying, sql query

An instruction you send to a database to find, add, change or remove data. For example: "get all orders from last week."

a bit more technical

A statement sent to a database, most often in SQL, that reads or changes data. SELECT reads rows; INSERT, UPDATE and DELETE change them. ORMs like Prisma generate queries from code, but a query still runs underneath.

picture it

Asking a librarian a specific question: "All cookbooks published after 2020, newest first." The librarian goes and fetches exactly that.

why it matters

Slow pages and wrong numbers are often query problems. When an agent says a query is slow or returns duplicates, you'll know the issue is how the app asks the database for data, not the screen itself.

what your agent might say
agent
The dashboard is slow because this query loads every order and then filters them in JavaScript. I'll filter by date in the query itself.
how you might use it
you → your agent
Show me the exact query the leaderboard page runs, explain it in plain English, and tell me if it could get slow as users grow.
common mistake

Thinking queries only read data. A query can also insert, update or delete, so "run this query" can mean "change this data".

builds on