You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Added
explainsql requests LOGS: the statements of server logs grouped into
requests, by the trace id of their sqlcommenter traceparent tag, their
transaction or their session, and the loops in them: a statement run
again and again in one request with another value each time (N+1), or
with the same values. For each loop, the batched statement that does the
work of all its runs at once (= ANY($1), or a LATERAL subquery over unnest($1) when its rows must stay per value), and how to make the ORM
send it. With -d, the batched statement and the runs are measured, each
run rolled back, with the round trips they need, and the foreign key
behind the loop is named. Reads statement logging
(log_min_duration_statement, log_statement with log_duration) in
stderr, csvlog and jsonlog, values from the parameters: detail lines, or
auto_explain entries. See the guide.
Server log entries carry their session (%c) and virtual transaction
(%v), from jsonlog and csvlog fields or a stderr log_line_prefix; explainsql logs --format json shows them.
--locks in connected mode, and L in the viewer: the locks the
statement takes, read inside the transaction that is rolled back. How
many fall outside the fast path, the tables, partitions and indexes they
come from (indexes nothing uses named), the commands that would wait for
them, other sessions' conflicting locks right now, and, from a second
connection that samples pg_stat_activity, what the statement waited on
as it ran. With --params or --bind, the locks of an execution of the
generic plan, which locks every partition, and of a custom plan. See the
guide.
With --locks, --measure or --prove, a measured run that waited for
another session's lock runs again, up to twice, with a note.
What a write costs, for a statement run with --allow-dml, and W in the
viewer: the rows each table got, read from the transaction's own counters
before the rollback, whether updates were HOT, the columns the statement
sets that kept them from it and the indexes that refer to them (unused
ones as a medium finding), the page-room and fillfactor note when no index
is to blame, and the index entries and WAL per row. From PostgreSQL 13, EXPLAIN ANALYZE of a statement that writes includes WAL. With --prove --allow-ddl, the statement runs again with those indexes dropped
in a transaction that is rolled back. See the guide.
Changed
The documentation is rewritten and reorganized: a getting-started page, a
guide chapter for each feature, a command-line reference, troubleshooting
and a contributing guide. The README's demo is recorded again on the
current viewer, with the suggested index measured in a rolled-back
transaction and the locks the statement takes.