CREATE VIEW objects AS
select ROUTINE_NAME AS `object`,
ROUTINE_SCHEMA AS `schema`,
ROUTINE_TYPE AS `object_type`
from information_schema.routines
union select TABLE_NAME, TABLE_SCHEMA, TABLE_TYPE
from information_schema.tables
union select TRIGGER_NAME, TRIGGER_SCHEMA, 'TRIGGER'
from information_schema.triggers
union select EVENT_NAME, EVENT_SCHEMA, 'EVENT'
from information_schema.events
union select INDEX_NAME, INDEX_SCHEMA, concat('INDEX (',INDEX_TYPE,')')
from information_schema.statistics
1条答案
按热度按时间f4t66c6m1#
INFORMATION_SCHEMA不提供所有对象的信息。
由于PERFORMANCE_SCHEMA.objects_summary_global_by_type不包含所有对象类型(并且PERFORMANCE_SCHEMA通常在默认情况下不启用),您可以创建自己的视图:
此视图基于在MariaDB 10.6中引入的sys.schema_object_overview