[FEAT MERGE] Support index usage monitoring

This commit is contained in:
obdev
2024-02-07 16:12:34 +00:00
committed by ob-robot
parent f7a91cb0b1
commit 112b0dfbd4
35 changed files with 3119 additions and 25 deletions

View File

@ -230,6 +230,7 @@ select * from information_schema.tables where table_schema in ('oceanbase', 'mys
| def | mysql | user | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | ALL_OB_EXTERNAL_TABLE_FILES | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | DBA_DB_LINKS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | DBA_INDEX_USAGE | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | DBA_IND_PARTITIONS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | DBA_IND_STATISTICS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | DBA_IND_SUBPARTITIONS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
@ -511,6 +512,7 @@ select * from information_schema.tables where table_schema in ('oceanbase', 'mys
| def | oceanbase | __all_func_history | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | __all_histogram_stat | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | __all_histogram_stat_history | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | __all_index_usage_info | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | __all_job | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | __all_job_log | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | __all_ls | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
@ -1017,6 +1019,8 @@ select * from information_schema.statistics where table_schema in ('oceanbase',
| def | oceanbase | __all_histogram_stat_history | 0 | oceanbase | PRIMARY | 5 | endpoint_num | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_histogram_stat_history | 0 | oceanbase | PRIMARY | 6 | savtime | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_histogram_stat_history | 1 | oceanbase | idx_histogram_stat_his_savtime | 1 | savtime | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_index_usage_info | 0 | oceanbase | PRIMARY | 1 | tenant_id | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_index_usage_info | 0 | oceanbase | PRIMARY | 2 | object_id | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_job | 0 | oceanbase | PRIMARY | 1 | tenant_id | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_job | 0 | oceanbase | PRIMARY | 2 | job | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_job | 1 | oceanbase | idx_job_powner | 1 | powner | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
@ -1516,6 +1520,7 @@ select * from information_schema.tables where table_schema in ('oceanbase', 'mys
| def | mysql | user | SYSTEM TABLE | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | ALL_OB_EXTERNAL_TABLE_FILES | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | DBA_DB_LINKS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | DBA_INDEX_USAGE | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | DBA_IND_PARTITIONS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | DBA_IND_STATISTICS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | DBA_IND_SUBPARTITIONS | SYSTEM VIEW | MEMORY | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
@ -1796,6 +1801,7 @@ select * from information_schema.tables where table_schema in ('oceanbase', 'mys
| def | oceanbase | __all_func_history | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | __all_histogram_stat | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | __all_histogram_stat_history | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | __all_index_usage_info | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | __all_job | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | __all_job_log | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
| def | oceanbase | __all_ls | SYSTEM TABLE | InnoDB | NULL | DYNAMIC | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | utf8mb4_general_ci | NULL | NULL | |
@ -2437,6 +2443,8 @@ select * from information_schema.statistics where table_schema in ('oceanbase',
| def | oceanbase | __all_import_table_task | 0 | oceanbase | PRIMARY | 2 | task_id | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_import_table_task_history | 0 | oceanbase | PRIMARY | 1 | tenant_id | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_import_table_task_history | 0 | oceanbase | PRIMARY | 2 | task_id | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_index_usage_info | 0 | oceanbase | PRIMARY | 1 | tenant_id | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_index_usage_info | 0 | oceanbase | PRIMARY | 2 | object_id | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_job | 0 | oceanbase | PRIMARY | 1 | tenant_id | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_job | 0 | oceanbase | PRIMARY | 2 | job | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_job | 1 | oceanbase | idx_job_powner | 1 | powner | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
@ -3251,6 +3259,8 @@ select * from information_schema.statistics where table_schema in ('oceanbase',
| def | oceanbase | __all_histogram_stat_history | 0 | oceanbase | PRIMARY | 5 | endpoint_num | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_histogram_stat_history | 0 | oceanbase | PRIMARY | 6 | savtime | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_histogram_stat_history | 1 | oceanbase | idx_histogram_stat_his_savtime | 1 | savtime | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_index_usage_info | 0 | oceanbase | PRIMARY | 1 | tenant_id | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_index_usage_info | 0 | oceanbase | PRIMARY | 2 | object_id | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_job | 0 | oceanbase | PRIMARY | 1 | tenant_id | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_job | 0 | oceanbase | PRIMARY | 2 | job | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |
| def | oceanbase | __all_job | 1 | oceanbase | idx_job_powner | 1 | powner | A | NULL | NULL | NULL | | BTREE | | | YES | NULL |

View File

@ -324,6 +324,9 @@ _ha_tablet_info_batch_count
_hidden_sys_tenant_memory
_ignore_system_memory_over_limit_error
_io_callback_thread_count
_iut_enable
_iut_max_entries
_iut_stat_collection_type
_lcl_op_interval
_load_tde_encrypt_engine
_log_writer_parallelism

View File

@ -5568,3 +5568,25 @@ NETWORK_SPEED(MB/S) bigint(20) YES NULL
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.DBA_OB_AUX_STATISTICS limit 1);
cnt
1
desc oceanbase.DBA_INDEX_USAGE;
Field Type Null Key Default Extra
OBJECT_ID bigint(20) NO NULL
NAME varchar(128) NO
OWNER varchar(128) NO
TOTAL_ACCESS_COUNT bigint(20) NO NULL
TOTAL_EXEC_COUNT bigint(20) NO NULL
TOTAL_ROWS_RETURNED bigint(20) NO NULL
BUCKET_0_ACCESS_COUNT bigint(20) NO NULL
BUCKET_1_ACCESS_COUNT bigint(20) NO NULL
BUCKET_2_10_ACCESS_COUNT bigint(20) NO NULL
BUCKET_2_10_ROWS_RETURNED bigint(20) NO NULL
BUCKET_11_100_ACCESS_COUNT bigint(20) NO NULL
BUCKET_11_100_ROWS_RETURNED bigint(20) NO NULL
BUCKET_101_1000_ACCESS_COUNT bigint(20) NO NULL
BUCKET_101_1000_ROWS_RETURNED bigint(20) NO NULL
BUCKET_1000_PLUS_ACCESS_COUNT bigint(20) NO NULL
BUCKET_1000_PLUS_ROWS_RETURNED bigint(20) NO NULL
LAST_USED varchar(128) NO NULL
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.DBA_INDEX_USAGE limit 1);
cnt
1

View File

@ -8009,3 +8009,48 @@ NETWORK_SPEED(MB/S) bigint(20) YES NULL
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.CDB_OB_AUX_STATISTICS limit 1);
cnt
1
desc oceanbase.DBA_INDEX_USAGE;
Field Type Null Key Default Extra
OBJECT_ID bigint(20) NO NULL
NAME varchar(128) NO
OWNER varchar(128) NO
TOTAL_ACCESS_COUNT bigint(20) NO NULL
TOTAL_EXEC_COUNT bigint(20) NO NULL
TOTAL_ROWS_RETURNED bigint(20) NO NULL
BUCKET_0_ACCESS_COUNT bigint(20) NO NULL
BUCKET_1_ACCESS_COUNT bigint(20) NO NULL
BUCKET_2_10_ACCESS_COUNT bigint(20) NO NULL
BUCKET_2_10_ROWS_RETURNED bigint(20) NO NULL
BUCKET_11_100_ACCESS_COUNT bigint(20) NO NULL
BUCKET_11_100_ROWS_RETURNED bigint(20) NO NULL
BUCKET_101_1000_ACCESS_COUNT bigint(20) NO NULL
BUCKET_101_1000_ROWS_RETURNED bigint(20) NO NULL
BUCKET_1000_PLUS_ACCESS_COUNT bigint(20) NO NULL
BUCKET_1000_PLUS_ROWS_RETURNED bigint(20) NO NULL
LAST_USED varchar(128) NO NULL
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.DBA_INDEX_USAGE limit 1);
cnt
1
desc oceanbase.CDB_INDEX_USAGE;
Field Type Null Key Default Extra
CON_ID bigint(20) NO NULL
OBJECT_ID bigint(20) NO NULL
NAME varchar(128) NO
OWNER varchar(128) NO
TOTAL_ACCESS_COUNT bigint(20) NO NULL
TOTAL_EXEC_COUNT bigint(20) NO NULL
TOTAL_ROWS_RETURNED bigint(20) NO NULL
BUCKET_0_ACCESS_COUNT bigint(20) NO NULL
BUCKET_1_ACCESS_COUNT bigint(20) NO NULL
BUCKET_2_10_ACCESS_COUNT bigint(20) NO NULL
BUCKET_2_10_ROWS_RETURNED bigint(20) NO NULL
BUCKET_11_100_ACCESS_COUNT bigint(20) NO NULL
BUCKET_11_100_ROWS_RETURNED bigint(20) NO NULL
BUCKET_101_1000_ACCESS_COUNT bigint(20) NO NULL
BUCKET_101_1000_ROWS_RETURNED bigint(20) NO NULL
BUCKET_1000_PLUS_ACCESS_COUNT bigint(20) NO NULL
BUCKET_1000_PLUS_ROWS_RETURNED bigint(20) NO NULL
LAST_USED varchar(128) NO NULL
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from oceanbase.CDB_INDEX_USAGE limit 1);
cnt
1

View File

@ -8661,3 +8661,29 @@ network_speed bigint(20) YES NULL
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_aux_stat;
IF(count(*) >= 0, 1, 0)
1
desc oceanbase.__all_virtual_index_usage_info;
Field Type Null Key Default Extra
tenant_id bigint(20) NO PRI NULL
object_id bigint(20) NO PRI NULL
gmt_create timestamp(6) NO NULL
gmt_modified timestamp(6) NO NULL
name varchar(128) NO NULL
owner varchar(128) NO NULL
total_access_count bigint(20) NO NULL
total_exec_count bigint(20) NO NULL
total_rows_returned bigint(20) NO NULL
bucket_0_access_count bigint(20) NO NULL
bucket_1_access_count bigint(20) NO NULL
bucket_2_10_access_count bigint(20) NO NULL
bucket_2_10_rows_returned bigint(20) NO NULL
bucket_11_100_access_count bigint(20) NO NULL
bucket_11_100_rows_returned bigint(20) NO NULL
bucket_101_1000_access_count bigint(20) NO NULL
bucket_101_1000_rows_returned bigint(20) NO NULL
bucket_1000_plus_access_count bigint(20) NO NULL
bucket_1000_plus_rows_returned bigint(20) NO NULL
last_used timestamp(6) NO NULL
last_flush_time timestamp(6) NO NULL
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_index_usage_info;
IF(count(*) >= 0, 1, 0)
1

View File

@ -265,6 +265,7 @@ select 0xffffffffff & table_id, table_name, table_type, database_id, part_num fr
479 __all_import_table_task 0 201001 1
480 __all_import_table_task_history 0 201001 1
494 __all_aux_stat 0 201001 1
495 __all_index_usage_info 0 201001 1
10001 __tenant_virtual_all_table 2 201001 1
10002 __tenant_virtual_table_column 2 201001 1
10003 __tenant_virtual_table_index 2 201001 1
@ -669,6 +670,7 @@ select 0xffffffffff & table_id, table_name, table_type, database_id, part_num fr
12426 __all_virtual_import_table_task 2 201001 1
12427 __all_virtual_import_table_task_history 2 201001 1
12447 __all_virtual_aux_stat 2 201001 1
12459 __all_virtual_index_usage_info 2 201001 1
20001 GV$OB_PLAN_CACHE_STAT 1 201001 1
20002 GV$OB_PLAN_CACHE_PLAN_STAT 1 201001 1
20003 SCHEMATA 1 201002 1
@ -1038,6 +1040,8 @@ select 0xffffffffff & table_id, table_name, table_type, database_id, part_num fr
21478 V$OB_TENANT_RUNTIME_INFO 1 201001 1
21497 DBA_OB_AUX_STATISTICS 1 201001 1
21498 CDB_OB_AUX_STATISTICS 1 201001 1
21499 DBA_INDEX_USAGE 1 201001 1
21513 CDB_INDEX_USAGE 1 201001 1
check sys table count and table_id range success
check count and table_id range for virtual table success
select * from information_schema.CHARACTER_SETS limit 1;