Overview
The information_schema.events view is used to record all event information.
Columns
Field |
Type |
Nullable |
Description |
|---|---|---|---|
| EVENT_CATALOG | varchar(64) | NO | The name of the directory to which the event belongs. This value is always 'def'. 'def' is a generic identifier used to indicate that an object in a system view belongs to the default directory. |
| EVENT_SCHEMA | varchar(128) | NO | The name of the database to which the event belongs. |
| EVENT_NAME | varchar(64) | NO | The name of the event. |
| DEFINER | varchar(93) | NO | The user who created the event. |
| TIME_ZONE | varchar(64) | NO | The time zone for scheduling events and the time zone that takes effect during event execution. The default value is SYSTEM. |
| EVENT_BODY | varchar(8) | NO | The language used by the statements in the DO clause of the event. This value is always SQL. |
| EVENT_DEFINITION | mediumtext | YES | The text of the SQL statement that constitutes the DO clause of the event. |
| EVENT_TYPE | varchar(9) | NO | Event repetition type. It can be either one-time or recurring. |
| EXECUTE_AT | datetime | YES | For the start time of a one-time event, Repeatable is NULL. |
| INTERVAL_VALUE | varchar(256) | YES | For recurring events, this indicates the number of intervals to wait before the event is executed again. For one-time events, the value is always NULL. |
| INTERVAL_FIELD | varchar(18) | YES | The time interval used for the wait period before a recurring event is triggered again. For one-time events, this value is always NULL. |
| SQL_MODE | text | NO | The SQL mode that takes effect when creating or modifying an event, and the SQL mode used when the event is executed. |
| STARTS | datetime | YES | The start date and time of a recurring event. If the event does not have a defined start date and time, this column is NULL. For one-time events, this column is always NULL. |
| ENDS | datetime | YES | For periodic events with an ENDS clause in their definition, this column contains the corresponding DATETIME value. EXECUTE_AT Like the column, this value parses any expression used. If there is no ENDS clause that affects the event timing, this column is NULL. |
| STATUS | varchar(18) | NO | Event status. Valid values:
|
| ON_COMPLETION | varchar(12) | NO | Valid values:
|
| CREATED | datetime | YES | The date and time when the event was created. |
| LAST_ALTERED | datetime | YES | The date and time when the event was last modified. |
| LAST_EXECUTED | datetime | YES | The date and time when the event was last executed. If the event has never been executed, this column is NULL. LAST_EXECUTED indicates the time when the event started. Therefore, the value in the ENDS column is never less than the value in the LAST_EXECUTED column. |
| EVENT_COMMENT | text | YES | If the event has comments, they are displayed here. If not, this value is empty. |
| ORIGINATOR | bigint(0) unsigned | NO | The service ID of the MySQL server that created the event is used during replication. If you execute an ALTER EVENT statement on the source, this value may be updated to the server's service ID at the time the statement is executed. The default value is 0. |
| CHARACTER_SET_CLIENT | varchar(32) | NO | When an event is created, the session's character_set_client The value of the system variable. |
| COLLATION_CONNECTION | varchar(32) | NO | When an event is created, the session's collation_connection The value of the system variable. |
| DATABASE_COLLATION | varchar(32) | NO | The collation of the database associated with the event. |
Sample query
Create an event named
e_1. This event is scheduled to execute at 00:00:00 on January 1, 3000, and executes the SQL statementSELECT 1.obclient> CREATE EVENT e_1 ON SCHEDULE AT "3000-01-01 00:00:00" DO SELECT 1;Query all information about the
e_1event.obclient> SELECT * FROM information_schema.events\GThe query result is as follows:
*************************** 1. row *************************** EVENT_CATALOG: def EVENT_SCHEMA: test EVENT_NAME: e_1 DEFINER: root@% TIME_ZONE: SYSTEM EVENT_BODY: SQL EVENT_DEFINITION: select 1; EVENT_TYPE: ONE TIME EXECUTE_AT: 3000-01-01 00:00:00 INTERVAL_VALUE: NULL INTERVAL_FIELD: NULL SQL_MODE: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION STARTS: NULL ENDS: NULL STATUS: ENABLED ON_COMPLETION: NOT PRESERVE CREATED: 2024-06-26 11:29:08 LAST_ALTERED: 2024-06-26 11:29:08 LAST_EXECUTED: NULL EVENT_COMMENT: NULL ORIGINATOR: NULL CHARACTER_SET_CLIENT: NULL COLLATION_CONNECTION: NULL DATABASE_COLLATION: NULL 1 row in set (0.002 sec)