SQL statements analysis

hi all,
are there some tools, system views, tables to see following things for SQL statements?

  • all sql statements parsed or executed like e.g. Oracle’s V$SQLAREA https://ss64.com/orav/V$SQLAREA.html
  • to see real execution plans used for a stateent (Oracle’s https://ss64.com/orav/V$SQL_PLAN.html)
  • to see explain plan without downloading html/js files from github - I’m in env where there is no open connection to public network
  • to see what variables were bound to particular SQL statement’s placeholder

thanks

Hi @pvanek,

For SQL statements analysis, you can refer to the Statements page in the Admin UI. The Statements page gets data from the crdb_internal.node_statement_statistics table which contains statement statistics (in-memory, not durable; local node only). This table is wiped periodically (by default, at least every two hours).

On the Statements Details page, there is a logical plan of the statement.

Hope this info helps.

If there is particular information that you require for your sql statement analysis, please create a feature request in the cockroach db GitHub repository so that it can be considered for a future release.

Regards,
Florence
Technical Support Engineer

can it be scripted somehow? With REST or SQL?

The data from the Admin UI can be scripted with SQL.

The Statements Page uses the query in the answer to this other forum post.

The Statements Details page uses the other columns in the crdb_internal.node_statement_statistics table.