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 information about all events.
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 indicates 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 for the statements in the DO clause of the event. This value is always SQL. |
| EVENT_DEFINITION | mediumtext | YES | The text of the SQL statements that constitute 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. For a recurring event, this value is NULL. |
| INTERVAL_VALUE | varchar(256) | YES | The number of intervals to wait between executions of a recurring event. For a one-time event, this value is always NULL. |
| INTERVAL_FIELD | varchar(18) | YES | The time unit for the interval used by a recurring event before it repeats. For a temporary event, this value is always NULL. |
| SQL_MODE | text | NO | The SQL mode that takes 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 a recurring event. If the event does not have a defined start date and time, this value is NULL. For a temporary event, this column is always NULL. |
| ENDS | datetime | YES | For a recurring event that includes an ENDS clause, this column contains the corresponding DATETIME value. Like the EXECUTE_AT column, this value resolves any expressions used. If there is no ENDS clause affecting the event's 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. If the event has never been executed, this column is NULL. LAST_EXECUTED indicates the start time of the event. Therefore, the value of the ENDS column is never less than the value of LAST_EXECUTED. |
| EVENT_COMMENT | text | YES | The text of the comment for the event, if any. If no comment is present, this value is empty. |
| 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 source server, 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 at 00:00:00 on January 1, 3000, 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)
