Skip to content
xiaoboluo768 edited this page Jun 7, 2020 · 2 revisions
  • 该表提供查询与information_schema.routines表类似的内容(早期版本主要用户记录存储过程),但information_schema.routines表记录的更加详细
  • 表结构定义
CREATE TABLE `proc` (
  `db` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
  `name` char(64) NOT NULL DEFAULT '',
  `type` enum('FUNCTION','PROCEDURE') NOT NULL,
  `specific_name` char(64) NOT NULL DEFAULT '',
  `language` enum('SQL') NOT NULL DEFAULT 'SQL',
  `sql_data_access` enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') NOT NULL DEFAULT 'CONTAINS_SQL',
  `is_deterministic` enum('YES','NO') NOT NULL DEFAULT 'NO',
  `security_type` enum('INVOKER','DEFINER') NOT NULL DEFAULT 'DEFINER',
  `param_list` blob NOT NULL,
  `returns` longblob NOT NULL,
  `body` longblob NOT NULL,
  `definer` char(93) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
  `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `body_utf8` longblob,
  PRIMARY KEY (`db`,`name`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures';
  • 表字段含义
  • 与information_schema.routines表类似,详情参考该表,这里不再赘述
  • 表记录内容示例
root@localhost : mysql 01:01:09> select * from proc limit 1\G;
*************************** 1. row ***************************
                  db: sys
                name: extract_schema_from_file_name
                type: FUNCTION
       specific_name: extract_schema_from_file_name
            language: SQL
     sql_data_access: NO_SQL
    is_deterministic: YES
       security_type: INVOKER
          param_list:  path VARCHAR(512) 
             returns: varchar(64) CHARSET utf8
                body: BEGIN RETURN LEFT(SUBSTRING_INDEX(SUBSTRING_INDEX(REPLACE(path, '\\', '/'), '/', -2), '/', 1), 64); END
             definer: mysql.sys@localhost
             created: 2017-07-01 14:31:32
            modified: 2017-07-01 14:31:32
            sql_mode: 
             comment: 
 Description
 
 Takes a raw file path, and attempts to extract the schema name from it.
 
 Useful for when interacting with Performance Schema data 
 concerning IO statistics, for example.
 
 Currently relies on the fact that a table data file will be within a 
 specified database directory (will not work with partitions or tables
 that specify an individual DATA_DIRECTORY).
 
 Parameters
 
 path (VARCHAR(512)):
 The full file path to a data file to extract the schema name from.
 
 Returns
 
 VARCHAR(64)
 
 Example
 
 mysql> SELECT sys.extract_schema_from_file_name('/var/lib/mysql/employees/employee.ibd');
 +----------------------------------------------------------------------------+
 | sys.extract_schema_from_file_name('/var/lib/mysql/employees/employee.ibd') |
 +----------------------------------------------------------------------------+
 | employees                                                                  |
 +----------------------------------------------------------------------------+
 1 row in set (0.00 sec)
 
character_set_client: utf8
collation_connection: utf8_general_ci
        db_collation: utf8_general_ci
           body_utf8: BEGIN RETURN LEFT(SUBSTRING_INDEX(SUBSTRING_INDEX(REPLACE(path, '\', '/'), '/', -2), '/', 1), 64); END
1 row in set (0.01 sec)

上一篇:plugin表 |下一篇:engine_cost表

Clone this wiki locally