Note
- This view is available starting with V4.3.2 in V4.3.x.
- This view is available starting with V4.2.1 BP5 and V4.2.4 in V4.2.x.
Purpose
The information_schema.events view records all event information.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| EVENT_CATALOG | varchar(64) | NO | The name of the catalog to which the event belongs. This value is always def. def is a generic identifier that specifies the objects in system views belong to the default catalog. |
| 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 used to schedule the event and the time zone that takes effect when the event is executed. The default value is SYSTEM. |
| EVENT_BODY | varchar(8) | NO | The language used 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 | The repetition type of the event, which can be one-time or recurring. |
| EXECUTE_AT | datetime | YES | The start time of a one-time event. This column is NULL for recurring events. |
| INTERVAL_VALUE | varchar(256) | YES | The number of intervals to wait between executions for recurring events. This value is always NULL for one-time events. |
| INTERVAL_FIELD | varchar(18) | YES | The time unit for the interval before the recurring event repeats. This value is always NULL for temporary events. |
| SQL_MODE | text | NO | The SQL mode in effect when the event is created or modified, and the SQL mode used when the event is executed. |
| STARTS | datetime | YES | The start date and time of the recurring event. This column is NULL if the event does not have a start date and time. For temporary events, this column is always NULL. |
| ENDS | datetime | YES | For recurring events that include the ENDS clause, this column contains the corresponding DATETIME value. Like the EXECUTE_AT column, this value resolves any used expressions. If the event does not have an ENDS clause that affects its timing, this column is NULL. |
| STATUS | varchar(18) | NO | The status of the event. 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. This column is NULL if the event has never been executed. LAST_EXECUTED indicates the start time of the event. Therefore, the value of the ENDS column will never be less than the value of the LAST_EXECUTED column. |
| EVENT_COMMENT | text | YES | The text of the comment if the event has one. This value is empty if the event has no comment. |
| ORIGINATOR | bigint(0) unsigned | NO | The service ID of the MySQL server that created the event, used in replication. If the ALTER EVENT statement is executed on the replication source, this value may be updated to the service ID of the server at the time the statement was executed. The default value is 0. |
| CHARACTER_SET_CLIENT | varchar(32) | NO | The value of the character_set_client system variable for the session when the event was created. |
| COLLATION_CONNECTION | varchar(32) | NO | The value of the collation_connection system variable for the session when the event was created. |
| 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 on January 1, 3000, at 00:00:00, and it 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)
