Trace

I remember things. Trace helps.
Trace is Lily's activity monitor. Open it from Tools › Activity in the sidebar on PostgreSQL, MySQL, SQL Server, ClickHouse and Trino.
Live
The Live tab lists the queries running now, refreshed every two seconds: session, user, state, how long it has been running and the query. Queries running for more than 30 seconds turn orange.
Each row can open the visual plan or Kill this query.
Queries that finish in under two seconds can slip between samples. The Top tab catches them.
What you can see
Seeing other users' queries needs a privilege:
| Engine | Needed |
|---|---|
| PostgreSQL | superuser or pg_read_all_stats |
| MySQL | PROCESS |
| SQL Server | VIEW SERVER STATE |
Without it, you see your own sessions and Lily tells you how many it could not show. On ClickHouse and Trino it cannot tell, and says so.
Recording
Click Arm and Trace keeps a timeline of the last 15 minutes. Drag the slider back to the moment things slowed down and see what was running then. Back to live returns.
The Captured tab keeps every query the recording caught, even after it finished, with Explain, Open in editor and Copy SQL.
Recording only runs while the Trace sheet is open. In Settings › Workspace:
- Remember Trace history on disk keeps the timeline for 24 hours, with values removed from the queries, so it survives closing Lily. Investigate uses it as evidence.
- Alert me while Trace is recording notifies you about queries slower than a threshold (30 seconds by default) and new lock waits. Notifications never include the query text.
- Keep recording while Lily is in the background keeps sampling when Lily is not the active app. A menu bar icon shows while it records.
Blocks
On PostgreSQL, MySQL 8 and SQL Server, Blocks draws who is blocking whom: each root blocker, the sessions waiting on it and for how long. From a session's menu:
- Explain why it's slow asks your AI tool for the root cause, from the query and plan with values removed, the blocking chain and the schema.
- Kill this session.
Top
Top ranks the 50 heaviest statements by total time, with calls, mean time and total.
- PostgreSQL reads
pg_stat_statements. If it is not installed, Enable it runsCREATE EXTENSION pg_stat_statements; it also has to be inshared_preload_librarieson the server. - MySQL reads
performance_schema. - SQL Server reads
sys.dm_exec_query_stats, and its totals are CPU time.
Killing
Before killing, Lily checks that the session is still running the same query, then asks you to confirm.
| Engine | Command |
|---|---|
| PostgreSQL | pg_terminate_backend, which ends the whole session |
| MySQL, SQL Server | KILL |
| ClickHouse | KILL QUERY |
| Trino | system.runtime.kill_query |
Killing is not available on read-only connections.
MongoDB and Redis
They have a simpler Activity panel in their workspace: running operations with kill on MongoDB, and slow commands and clients on Redis. See their engine pages.