cockroachdb / docs

CockroachDB user documentation
https://cockroachlabs.com/docs
Creative Commons Attribution 4.0 International
188 stars 456 forks source link

Add query for detecting slow statements #6828

Open florence-crl opened 4 years ago

florence-crl commented 4 years ago

Florence Morris (florence-crl) commented:

This query gets the same data as the UI Statements page (from https://forum.cockroachlabs.com/t/detecting-slow-sql-queries/3512/2) select key as "STATEMENT", implicit_txn as "TXN TYPE", count::float * service_lat_avg as "TIME", count as "EXECUTION COUNT", max_retries as "RETRIES", rows_avg as "ROWS AFFECTED", service_lat_avg as "LATENCY" from crdb_internal.node_statement_statistics order by "TIME" desc

Jira Issue: DOC-461

jseldess commented 3 years ago

cc @awoods187, @ericharmeling, @ianjevans, not sure if this query still matches the Statements page.

awoods187 commented 3 years ago

It does not but we will want to document this. Moving forward, we want everything to be available within the SQL shell, the DB console, or as metrics exportable to prometheus where possible. We will need to think about our approach for making sure that both the product and the documentation reflect ways for developers to access the relevant information by their preferred methodology.

exalate-issue-sync[bot] commented 2 years ago

Kevin Ngo (kevin-v-ngo) commented: Related doc improvement: https://cockroachlabs.atlassian.net/browse/DOC-2077