create table performance_schema.events_statements_history
(
    THREAD_ID               bigint unsigned                                    not null,
    EVENT_ID                bigint unsigned                                    not null,
    END_EVENT_ID            bigint unsigned                                    null,
    EVENT_NAME              varchar(128)                                       not null,
    SOURCE                  varchar(64)                                        null,
    TIMER_START             bigint unsigned                                    null,
    TIMER_END               bigint unsigned                                    null,
    TIMER_WAIT              bigint unsigned                                    null,
    LOCK_TIME               bigint unsigned                                    not null,
    SQL_TEXT                longtext                                           null,
    DIGEST                  varchar(64)                                        null,
    DIGEST_TEXT             longtext                                           null,
    CURRENT_SCHEMA          varchar(64)                                        null,
    OBJECT_TYPE             varchar(64)                                        null,
    OBJECT_SCHEMA           varchar(64)                                        null,
    OBJECT_NAME             varchar(64)                                        null,
    OBJECT_INSTANCE_BEGIN   bigint unsigned                                    null,
    MYSQL_ERRNO             int                                                null,
    RETURNED_SQLSTATE       varchar(5)                                         null,
    MESSAGE_TEXT            varchar(128)                                       null,
    ERRORS                  bigint unsigned                                    not null,
    WARNINGS                bigint unsigned                                    not null,
    ROWS_AFFECTED           bigint unsigned                                    not null,
    ROWS_SENT               bigint unsigned                                    not null,
    ROWS_EXAMINED           bigint unsigned                                    not null,
    CREATED_TMP_DISK_TABLES bigint unsigned                                    not null,
    CREATED_TMP_TABLES      bigint unsigned                                    not null,
    SELECT_FULL_JOIN        bigint unsigned                                    not null,
    SELECT_FULL_RANGE_JOIN  bigint unsigned                                    not null,
    SELECT_RANGE            bigint unsigned                                    not null,
    SELECT_RANGE_CHECK      bigint unsigned                                    not null,
    SELECT_SCAN             bigint unsigned                                    not null,
    SORT_MERGE_PASSES       bigint unsigned                                    not null,
    SORT_RANGE              bigint unsigned                                    not null,
    SORT_ROWS               bigint unsigned                                    not null,
    SORT_SCAN               bigint unsigned                                    not null,
    NO_INDEX_USED           bigint unsigned                                    not null,
    NO_GOOD_INDEX_USED      bigint unsigned                                    not null,
    NESTING_EVENT_ID        bigint unsigned                                    null,
    NESTING_EVENT_TYPE      enum ('TRANSACTION', 'STATEMENT', 'STAGE', 'WAIT') null,
    NESTING_EVENT_LEVEL     int                                                null,
    STATEMENT_ID            bigint unsigned                                    null,
    CPU_TIME                bigint unsigned                                    not null,
    MAX_CONTROLLED_MEMORY   bigint unsigned                                    not null,
    MAX_TOTAL_MEMORY        bigint unsigned                                    not null,
    EXECUTION_ENGINE        enum ('PRIMARY', 'SECONDARY')                      null,
    primary key (THREAD_ID, EVENT_ID) using hash
)
    engine = PERFORMANCE_SCHEMA;

