See how long it takes for an event to happen - [mysql]

Asked

Viewed 315 times

0

I’m new to mysql and has an event created in mysql database, and I was wondering if you have any way to check how much time is left for that event to run.

That is possible?

1 answer

0


In the Mysql documentation it says that Voce should use INFORMATION_SCHEMA to redeem information about an event. The field you will use to know how much time is left STARTS

 SELECT * FROM INFORMATION_SCHEMA.EVENTS
   WHERE EVENT_NAME = 'e_daily'
     AND EVENT_SCHEMA = 'myschema';

The result is:

*************************** 1. row ***************************
       EVENT_CATALOG: def
        EVENT_SCHEMA: test
          EVENT_NAME: e_daily
             DEFINER: me@localhost
           TIME_ZONE: SYSTEM
          EVENT_BODY: SQL
    EVENT_DEFINITION: BEGIN
        INSERT INTO site_activity.totals (time, total)
          SELECT CURRENT_TIMESTAMP, COUNT(*)
            FROM site_activity.sessions;
        DELETE FROM site_activity.sessions;
      END
          EVENT_TYPE: RECURRING
          EXECUTE_AT: NULL
      INTERVAL_VALUE: 1
      INTERVAL_FIELD: DAY
            SQL_MODE:
              STARTS: 2008-09-03 12:13:39
                ENDS: NULL
              STATUS: ENABLED
       ON_COMPLETION: NOT PRESERVE
             CREATED: 2008-09-03 12:13:39
        LAST_ALTERED: 2008-09-03 12:13:39
       LAST_EXECUTED: NULL
       EVENT_COMMENT: Saves total number of sessions then clears the
                      table each day
          ORIGINATOR: 1
CHARACTER_SET_CLIENT: latin1
COLLATION_CONNECTION: latin1_swedish_ci
  DATABASE_COLLATION: latin1_swedish_ci
  • Yes this shows the details of the event but n shows how much time remains for that event to be run again

  • Just take STARTS and subtract from NOW().

Browser other questions tagged

You are not signed in. Login or sign up in order to post.