Admin ui statement page

(yeriahn) #1

https://www.cockroachlabs.com/docs/v2.1/admin-ui-statements-page.html

In this page, I found the SQL that have much latency.
I wonder, Could I get information about statement history using SQL?
Like "select statement, time, execution count … from 000 ".
I found the crdb_internal.node_statement_statistics. but there is different the statement page in Admin UI.

I have a second question.
Do you have slow query logging?
If the sql executed long time(3s), then write the log.

0 Likes

(Tim O'Brien) #2

The answer to your second question is yes: you can use the sql.trace.txn.enable_threshold cluster setting. In your case you’d set it to 3s and it would execute a trace for any query over 3s. This does require some overhead, so it could have a performance impact, but in most cases it should be negligible.

I’m not sure I follow your first question - do you want to know how to query the crdb_internal.node_statement_statistics table? Or are you looking for something else from the statements page in the UI?

0 Likes

(yeriahn) #3

Thank you your answer. ^^

First question is how to query the cluster’s sql statement history.

0 Likes