有没有表使用频率统计

Viewed 32

请问有没有对表使用频率的统计?比如xxx表每日DML语句执行次数,select查询次数等,目的是想找出热点表,便于优化性能。
同时是否可以关联至哪一个用户使用最频繁?

1 Answers

这个你可以参考审计日志里面的记录信息,2.1 版本的审计日志更详细;
这里面有这些表和字段:
show tables;
+-----------------------------+
| Tables_in___internal_schema |
+-----------------------------+
| audit_log |
| column_statistics |
| histogram_statistics |
+-----------------------------+
desc column_statistics;
+--------------------+----------------+------+-------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+----------------+------+-------+---------+-------+
| id | VARCHAR(4096) | No | true | NULL | |
| catalog_id | VARCHAR(64) | No | true | NULL | |
| db_id | VARCHAR(64) | No | true | NULL | |
| tbl_id | VARCHAR(64) | No | true | NULL | |
| idx_id | VARCHAR(64) | No | true | NULL | |
| col_id | VARCHAR(64) | No | true | NULL | |
| part_id | VARCHAR(64) | Yes | true | NULL | |
| count | BIGINT | Yes | false | NULL | NONE |
| ndv | BIGINT | Yes | false | NULL | NONE |
| null_count | BIGINT | Yes | false | NULL | NONE |
| min | VARCHAR(65533) | Yes | false | NULL | NONE |
| max | VARCHAR(65533) | Yes | false | NULL | NONE |
| data_size_in_bytes | BIGINT | Yes | false | NULL | NONE |
| update_time | DATETIME | No | false | NULL | NONE |
+--------------------+----------------+------+-------+---------+-------+
desc column_statistics;
+--------------------+----------------+------+-------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+----------------+------+-------+---------+-------+
| id | VARCHAR(4096) | No | true | NULL | |
| catalog_id | VARCHAR(64) | No | true | NULL | |
| db_id | VARCHAR(64) | No | true | NULL | |
| tbl_id | VARCHAR(64) | No | true | NULL | |
| idx_id | VARCHAR(64) | No | true | NULL | |
| col_id | VARCHAR(64) | No | true | NULL | |
| part_id | VARCHAR(64) | Yes | true | NULL | |
| count | BIGINT | Yes | false | NULL | NONE |
| ndv | BIGINT | Yes | false | NULL | NONE |
| null_count | BIGINT | Yes | false | NULL | NONE |
| min | VARCHAR(65533) | Yes | false | NULL | NONE |
| max | VARCHAR(65533) | Yes | false | NULL | NONE |
| data_size_in_bytes | BIGINT | Yes | false | NULL | NONE |
| update_time | DATETIME | No | false | NULL | NONE |
+--------------------+----------------+------+-------+---------+-------+
desc histogram_statistics;
+-------------+----------------+------+-------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+----------------+------+-------+---------+-------+
| id | VARCHAR(4096) | No | true | NULL | |
| catalog_id | VARCHAR(64) | No | true | NULL | |
| db_id | VARCHAR(64) | No | true | NULL | |
| tbl_id | VARCHAR(64) | No | true | NULL | |
| idx_id | VARCHAR(64) | No | true | NULL | |
| col_id | VARCHAR(64) | No | true | NULL | |
| sample_rate | DOUBLE | No | false | NULL | NONE |
| buckets | VARCHAR(65533) | No | false | NULL | NONE |
| update_time | DATETIME | No | false | NULL | NONE |
+-------------+----------------+------+-------+---------+-------+
2.0 之前的版本可以参考这个文档:
https://doris.apache.org/zh-CN/docs/2.0/admin-manual/audit-plugin