Add IS.query_statistics to summarize resource metrics by query text. The key for
the table might be either the original query text or the canonical form of the
query text where canonical includes some/all of strip query text, remove extra
white space, replace literals with #. For me canonical means that all of the
above must be done. This can then reuse the same counters kept for
IS.user_statistics -- at query end read from them for this table and for
user_statistics.
It also might be useful to:
* have an option to sample queries for this rather than take all
* not include queries from some accounts for this table (security)
* limit max size of query text
IS.user_statistics from the Facebook patch has metrics I am interested in.
Current definition for it is listed below, but some of those columns are invalid
in this context (COMMANDS_DDL, etc).
USER_STATISTICS CREATE TEMPORARY TABLE `USER_STATISTICS` (
`USER_NAME` varchar(192) NOT NULL DEFAULT '',
`BINLOG_BYTES_WRITTEN` bigint(21) NOT NULL DEFAULT '0',
`BYTES_RECEIVED` bigint(21) NOT NULL DEFAULT '0',
`BYTES_SENT` bigint(21) NOT NULL DEFAULT '0',
`COMMANDS_DDL` bigint(21) NOT NULL DEFAULT '0',
`COMMANDS_DELETE` bigint(21) NOT NULL DEFAULT '0',
`COMMANDS_HANDLER` bigint(21) NOT NULL DEFAULT '0',
`COMMANDS_INSERT` bigint(21) NOT NULL DEFAULT '0',
`COMMANDS_OTHER` bigint(21) NOT NULL DEFAULT '0',
`COMMANDS_SELECT` bigint(21) NOT NULL DEFAULT '0',
`COMMANDS_TRANSACTION` bigint(21) NOT NULL DEFAULT '0',
`COMMANDS_UPDATE` bigint(21) NOT NULL DEFAULT '0',
`CONNECTIONS_CONCURRENT` int(11) NOT NULL DEFAULT '0',
`CONNECTIONS_DENIED_MAX_GLOBAL` bigint(21) NOT NULL DEFAULT '0',
`CONNECTIONS_DENIED_MAX_USER` bigint(21) NOT NULL DEFAULT '0',
`CONNECTIONS_LOST` bigint(21) NOT NULL DEFAULT '0',
`CONNECTIONS_TOTAL` bigint(21) NOT NULL DEFAULT '0',
`DISK_READ_BYTES` bigint(21) NOT NULL DEFAULT '0',
`DISK_READ_REQUESTS` bigint(21) NOT NULL DEFAULT '0',
`DISK_READ_SVC_USECS` bigint(21) NOT NULL DEFAULT '0',
`DISK_READ_WAIT_USECS` bigint(21) NOT NULL DEFAULT '0',
`ERRORS_ACCESS_DENIED` bigint(21) NOT NULL DEFAULT '0',
`ERRORS_TOTAL` bigint(21) NOT NULL DEFAULT '0',
`MICROSECONDS_CPU` bigint(21) NOT NULL DEFAULT '0',
`MICROSECONDS_WALL` bigint(21) NOT NULL DEFAULT '0',
`QUERIES_EMPTY` bigint(21) NOT NULL DEFAULT '0',
`RECORDS_IN_RANGE_CALLS` bigint(21) NOT NULL DEFAULT '0',
`ROWS_DELETED` bigint(21) NOT NULL DEFAULT '0',
`ROWS_FETCHED` bigint(21) NOT NULL DEFAULT '0',
`ROWS_INSERTED` bigint(21) NOT NULL DEFAULT '0',
`ROWS_READ` bigint(21) NOT NULL DEFAULT '0',
`ROWS_UPDATED` bigint(21) NOT NULL DEFAULT '0',
`ROWS_INDEX_FIRST` bigint(21) NOT NULL DEFAULT '0',
`ROWS_INDEX_NEXT` bigint(21) NOT NULL DEFAULT '0',
`TRANSACTIONS_COMMIT` bigint(21) NOT NULL DEFAULT '0',
`TRANSACTIONS_ROLLBACK` bigint(21) NOT NULL DEFAULT '0'
) ENGINE=MEMORY DEFAULT CHARSET=utf8
|