spanner-cli itself may issue SQLs in addition to SQLs directly issued by users.
For example, SELECT 1 issued for heartbeat purposes, etc.
Such queries appear in Cloud Spanner's query statistics and may confuse users who are unaware that spanner-cli is issuing them.
To identify such queries more easily, I suggest adding spanner-cli specific request tags to the queries.
As far as I can find, spanner-cli seems to issue its own SELECT query for the following uses.
SELECT 1 - At the beginning of a Read-write transaction
SELECT 1 - To check if DB exists.
SELECT 1 - Heartbeat
SELECT ... FROM INFORMATION_SCHEMA.TABLES ... - SHOW TABLES
SELECT ... FROM INFORMATION_SCHEMA.INDEXES ... - SHOW INDEX
SELECT ... FROM INFORMATION_SCHEMA.COLUMNS ... - SHOW COLUMNS
I am not sure what specific string of text to tag, so I need your opinion.
As an example, it seems that Cloud Console uses sys_cloud_console_* to issue some queries.
spanner> SELECT SUBSTR(text,0,20) AS text, request_tag,
-> FROM spanner_sys.query_stats_top_minute
-> WHERE request_tag <> "";
+----------------------+---------------------------------------------+
| text | request_tag |
+----------------------+---------------------------------------------+
| SELECT TABLE_NAME, T | sys_cloud_console_DatabaseTables |
| SELECT VIEW_DEFINITI | sys_cloud_console_TableDetailViewDefinition |
| SELECT OPTION_NAME, | sys_cloud_console_DatabaseOptions |
| SELECT INDEX_NAME, I | sys_cloud_console_TableDetailIndexes |
| SELECT TABLE_NAME, C | sys_cloud_console_TableDetailTableColumnMap |
| SELECT TABLE_NAME, C | sys_cloud_console_DatabaseTableColumnMap |
| SELECT TABLE_NAME, C | sys_cloud_console_TableDetailColumns |
| SELECT TABLE_NAME, T | sys_cloud_console_TableDetail |
| SELECT TABLE_NAME, T | sys_cloud_console_DatabaseTables |
| SELECT OPTION_NAME, | sys_cloud_console_DatabaseOptions |
| SELECT TABLE_NAME, C | sys_cloud_console_DatabaseTableColumnMap |
+----------------------+---------------------------------------------+
spanner-cli itself may issue SQLs in addition to SQLs directly issued by users.
For example,
SELECT 1issued for heartbeat purposes, etc.Such queries appear in Cloud Spanner's query statistics and may confuse users who are unaware that spanner-cli is issuing them.
To identify such queries more easily, I suggest adding spanner-cli specific request tags to the queries.
As far as I can find, spanner-cli seems to issue its own SELECT query for the following uses.
SELECT 1- At the beginning of a Read-write transactionSELECT 1- To check if DB exists.SELECT 1- HeartbeatSELECT ... FROM INFORMATION_SCHEMA.TABLES ...- SHOW TABLESSELECT ... FROM INFORMATION_SCHEMA.INDEXES ...- SHOW INDEXSELECT ... FROM INFORMATION_SCHEMA.COLUMNS ...- SHOW COLUMNSI am not sure what specific string of text to tag, so I need your opinion.
As an example, it seems that Cloud Console uses
sys_cloud_console_*to issue some queries.