Rechercher dans le manuel MySQL

26.12.5 Performance Schema Stage Event Tables

The Performance Schema instruments stages, which are steps during the statement-execution process, such as parsing a statement, opening a table, or performing a filesort operation. Stages correspond to the thread states displayed by SHOW PROCESSLIST or that are visible in the INFORMATION_SCHEMA.PROCESSLIST table. Stages begin and end when state values change.

Within the event hierarchy, wait events nest within stage events, which nest within statement events, which nest within transaction events.

These tables store stage events:

The following sections describe the stage event tables. There are also summary tables that aggregate information about stage events; see Section 26.12.17.2, “Stage Summary Tables”.

For more information about the relationship between the three stage event tables, see Section 26.9, “Performance Schema Tables for Current and Historical Events”.

Configuring Stage Event Collection

To control whether to collect stage events, set the state of the relevant instruments and consumers:

  • The setup_instruments table contains instruments with names that begin with stage. Use these instruments to enable or disable collection of individual stage event classes.

  • The setup_consumers table contains consumer values with names corresponding to the current and historical stage event table names. Use these consumers to filter collection of stage events.

Other than those instruments that provide statement progress information, the stage instruments are disabled by default. For example:

  1. mysql> SELECT NAME, ENABLED, TIMED
  2.        FROM performance_schema.setup_instruments
  3.        WHERE NAME RLIKE 'stage/sql/[a-c]';
  4. +----------------------------------------------------+---------+-------+
  5. | NAME                                               | ENABLED | TIMED |
  6. +----------------------------------------------------+---------+-------+
  7. | stage/sql/After create                             | NO      | NO    |
  8. | stage/sql/allocating local table                   | NO      | NO    |
  9. | stage/sql/altering table                           | NO      | NO    |
  10. | stage/sql/committing alter table to storage engine | NO      | NO    |
  11. | stage/sql/Changing master                          | NO      | NO    |
  12. | stage/sql/Checking master version                  | NO      | NO    |
  13. | stage/sql/checking permissions                     | NO      | NO    |
  14. | stage/sql/cleaning up                              | NO      | NO    |
  15. | stage/sql/closing tables                           | NO      | NO    |
  16. | stage/sql/Connecting to master                     | NO      | NO    |
  17. | stage/sql/converting HEAP to MyISAM                | NO      | NO    |
  18. | stage/sql/Copying to group table                   | NO      | NO    |
  19. | stage/sql/Copying to tmp table                     | NO      | NO    |
  20. | stage/sql/copy to tmp table                        | NO      | NO    |
  21. | stage/sql/Creating sort index                      | NO      | NO    |
  22. | stage/sql/creating table                           | NO      | NO    |
  23. | stage/sql/Creating tmp table                       | NO      | NO    |
  24. +----------------------------------------------------+---------+-------+

Stage event instruments that provide statement progress information are enabled and timed by default:

  1. mysql> SELECT NAME, ENABLED, TIMED
  2.        FROM performance_schema.setup_instruments
  3.        WHERE ENABLED='YES' AND NAME LIKE "stage/%";
  4. +------------------------------------------------------+---------+-------+
  5. | NAME                                                 | ENABLED | TIMED |
  6. +------------------------------------------------------+---------+-------+
  7. | stage/sql/copy to tmp table                          | YES     | YES   |
  8. | stage/sql/Applying batch of row changes (write)      | YES     | YES   |
  9. | stage/sql/Applying batch of row changes (update)     | YES     | YES   |
  10. | stage/sql/Applying batch of row changes (delete)     | YES     | YES   |
  11. | stage/innodb/alter table (end)                       | YES     | YES   |
  12. | stage/innodb/alter table (flush)                     | YES     | YES   |
  13. | stage/innodb/alter table (insert)                    | YES     | YES   |
  14. | stage/innodb/alter table (log apply index)           | YES     | YES   |
  15. | stage/innodb/alter table (log apply table)           | YES     | YES   |
  16. | stage/innodb/alter table (merge sort)                | YES     | YES   |
  17. | stage/innodb/alter table (read PK and internal sort) | YES     | YES   |
  18. | stage/innodb/buffer pool load                        | YES     | YES   |
  19. | stage/innodb/clone (file copy)                       | YES     | YES   |
  20. | stage/innodb/clone (redo copy)                       | YES     | YES   |
  21. | stage/innodb/clone (page copy)                       | YES     | YES   |
  22. +------------------------------------------------------+---------+-------+

The stage consumers are disabled by default:

  1. mysql> SELECT *
  2.        FROM performance_schema.setup_consumers
  3.        WHERE NAME LIKE 'events_stages%';
  4. +----------------------------+---------+
  5. | NAME                       | ENABLED |
  6. +----------------------------+---------+
  7. | events_stages_current      | NO      |
  8. | events_stages_history      | NO      |
  9. | events_stages_history_long | NO      |
  10. +----------------------------+---------+

To control stage event collection at server startup, use lines like these in your my.cnf file:

  • Enable:

    [mysqld]
    performance-schema-instrument='stage/%=ON'
    performance-schema-consumer-events-stages-current=ON
    performance-schema-consumer-events-stages-history=ON
    performance-schema-consumer-events-stages-history-long=ON
  • Disable:

    [mysqld]
    performance-schema-instrument='stage/%=OFF'
    performance-schema-consumer-events-stages-current=OFF
    performance-schema-consumer-events-stages-history=OFF
    performance-schema-consumer-events-stages-history-long=OFF

To control stage event collection at runtime, update the setup_instruments and setup_consumers tables:

  • Enable:

    1. UPDATE performance_schema.setup_instruments
    2. SET ENABLED = 'YES', TIMED = 'YES'
    3. WHERE NAME = 'stage/%';
    4.  
    5. UPDATE performance_schema.setup_consumers
    6. SET ENABLED = 'YES'
    7. WHERE NAME LIKE 'events_stages%';
  • Disable:

    1. UPDATE performance_schema.setup_instruments
    2. SET ENABLED = 'NO', TIMED = 'NO'
    3. WHERE NAME = 'stage/%';
    4.  
    5. UPDATE performance_schema.setup_consumers
    6. SET ENABLED = 'NO'
    7. WHERE NAME LIKE 'events_stages%';

To collect only specific stage events, enable only the corresponding stage instruments. To collect stage events only for specific stage event tables, enable the stage instruments but only the stage consumers corresponding to the desired tables.

For additional information about configuring event collection, see Section 26.3, “Performance Schema Startup Configuration”, and Section 26.4, “Performance Schema Runtime Configuration”.

Inhoudsopgave Haut

Stage Event Progress Information

The Performance Schema stage event tables contain two columns that, taken together, provide a stage progress indicator for each row:

  • WORK_COMPLETED: The number of work units completed for the stage

  • WORK_ESTIMATED: The number of work units expected for the stage

Each column is NULL if no progress information is provided for an instrument. Interpretation of the information, if it is available, depends entirely on the instrument implementation. The Performance Schema tables provide a container to store progress data, but make no assumptions about the semantics of the metric itself:

  • A work unit is an integer metric that increases over time during execution, such as the number of bytes, rows, files, or tables processed. The definition of work unit for a particular instrument is left to the instrumentation code providing the data.

  • The WORK_COMPLETED value can increase one or many units at a time, depending on the instrumented code.

  • The WORK_ESTIMATED value can change during the stage, depending on the instrumented code.

Instrumentation for a stage event progress indicator can implement any of the following behaviors:

  • No progress instrumentation

    This is the most typical case, where no progress data is provided. The WORK_COMPLETED and WORK_ESTIMATED columns are both NULL.

  • Unbounded progress instrumentation

    Only the WORK_COMPLETED column is meaningful. No data is provided for the WORK_ESTIMATED column, which displays 0.

    By querying the events_stages_current table for the monitored session, a monitoring application can report how much work has been performed so far, but cannot report whether the stage is near completion. Currently, no stages are instrumented like this.

  • Bounded progress instrumentation

    The WORK_COMPLETED and WORK_ESTIMATED columns are both meaningful.

    This type of progress indicator is appropriate for an operation with a defined completion criterion, such as the table-copy instrument described later. By querying the events_stages_current table for the monitored session, a monitoring application can report how much work has been performed so far, and can report the overall completion percentage for the stage, by computing the WORK_COMPLETED / WORK_ESTIMATED ratio.

The stage/sql/copy to tmp table instrument illustrates how progress indicators work. During execution of an ALTER TABLE statement, the stage/sql/copy to tmp table stage is used, and this stage can execute potentially for a long time, depending on the size of the data to copy.

The table-copy task has a defined termination (all rows copied), and the stage/sql/copy to tmp table stage is instrumented to provided bounded progress information: The work unit used is number of rows copied, WORK_COMPLETED and WORK_ESTIMATED are both meaningful, and their ratio indicates task percentage complete.

To enable the instrument and the relevant consumers, execute these statements:

  1. UPDATE performance_schema.setup_instruments
  2. SET ENABLED='YES'
  3. WHERE NAME='stage/sql/copy to tmp table';
  4.  
  5. UPDATE performance_schema.setup_consumers
  6. SET ENABLED='YES'
  7. WHERE NAME LIKE 'events_stages_%';

To see the progress of an ongoing ALTER TABLE statement, select from the events_stages_current table.


Zoek in de MySQL-handleiding

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-performance-schema-stage-tables.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:en Manuel MySQL : https://dev.mysql.com/

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut