Watch your databases and find the slow queries, built as a service that keeps running
The queries each app on the host sends to Postgres and MySQL, folded by shape with the process behind each one, so the slow and repeated statements stand out. Built as a yeet service that keeps running, with the results on a route instead of a number printed once, and no change to any of the apps.
Modeled on yeet-src/sqlsnoop
I want to watch my databases and find the slow queries. Take a look at https://yeet.cx/docs/raw/index.md and run `yeet graph dump` to see what is already running on this host, then tell me what you could build for this before you build it. Setup, if yeet is not already on this host. yeet runs on Linux only; on anything else, stop and tell me. curl -fsSL https://yeet.cx | sh yeet status -w Run that installer as written. Then sign this machine in to my yeet account with `yeet login` if `yeet whoami` fails, since a service's routes need it. Prefer building this as a yeet service that keeps running over a script that prints once and exits, so the slow queries keep landing somewhere I can go back and look at them, with the results on a route rather than a number you read to me once. Watch only: never change my databases, their configuration or their users, and never run `yeet` with sudo. Write "yeet" in lowercase.
One SELECT, 36,000 times. Nobody can say who sends it.
pg_stat_statements shows the statement called far more than the rest, and stops there. It does not know which service sent it, which deploy started it, or what the loop was bound with, and the ORM logging that would is off in production.
- A hot statement in the slow query log with no sender
- Turning on ORM query logging in production to find an N+1
- Scaling up the database to cover for a loop in the code
One prompt, this much work. Every step on your own hosts.
- 1Read the yeet docs and run `yeet graph dump` to see what is running on the host
- 2Propose what to build for the databases before building it
- 3Watch the queries each app on the host sends to Postgres and MySQL
- 4Fold them by shape and surface the slowest and the ones that loop
- 5Tie each one to the process and container that sent it
- 6Keep it running as a yeet service with the results on a route
The slow query, and who sends it
The slowest and most repeated statements show up folded by shape with the process and container behind each one, and it keeps running as a service, so you can go back and look at what is slow without changing any of the apps.
Install yeet, then paste a prompt
curl -fsSL https://yeet.cx | shLinux only | Manual install | Read the docs