Keine Cache-Version

Caching deaktiviert Standardeinstellung für diese Seite:aktiviert (code DEF204)
Wenn die Anzeige zu langsam ist, können Sie den Benutzermodus deaktivieren, um die zwischengespeicherte Version anzuzeigen.

Rechercher dans le manuel MySQL

26.19.2 Obtaining Parent Event Information

The data_locks table shows data locks held and requested. Rows of this table have a THREAD_ID column indicating the thread ID of the session that owns the lock, and an EVENT_ID column indicating the Performance Schema event that caused the lock. Tuples of (THREAD_ID, EVENT_ID) values implicitly identify a parent event in other Performance Schema tables:

  • The parent wait event in the events_waits_xxx tables

  • The parent stage event in the events_stages_xxx tables

  • The parent statement event in the events_statements_xxx tables

  • The parent transaction event in the events_transactions_current table

To obtain details about the parent event, join the THREAD_ID and EVENT_ID columns with the columns of like name in the appropriate parent event table. The relation is based on a nested set data model, so the join has several clauses. Given parent and child tables represented by parent and child, respectively, the join looks like this:

  1.   parent.THREAD_ID = child.THREAD_ID        /* 1 */
  2.   AND parent.EVENT_ID < child.EVENT_ID      /* 2 */
  3.   AND (
  4.     child.EVENT_ID <= parent.END_EVENT_ID   /* 3a */
  5.     OR parent.END_EVENT_ID IS NULL          /* 3b */
  6.   )

The condititions for the join are:

  1. The parent and child events are in the same thread.

  2. The child event begins after the parent event, so its EVENT_ID value is greater than that of the parent.

  3. The parent event has either completed or is still running.

To find lock information, data_locks is the table containing child events.

The data_locks table shows only existing locks, so these considerations apply regarding which table contains the parent event:

Wait, stage, and statement events disappear quickly from the history. If a statement that executed a long time ago took a lock but is in a still-open transaction, it might not be possible to find the statement, but it is possible to find the transaction.

This is why the nested set data model works better for locating parent events. Following links in a parent/child relationship (data lock -> parent wait -> parent stage -> parent transaction) does not work well when intermediate nodes are already gone from the history tables.

The following scenario illustrates how to find the parent transaction of a statement in which a lock was taken:

Session A:

  1. [2] SELECT * FROM t1 WHERE pk = 1;
  2. [3] SELECT 'Hello, world';

Session B:

  1. SELECT ...
  2. FROM performance_schema.events_transactions_current AS parent
  3.   INNER JOIN performance_schema.data_locks AS child
  4.   parent.THREAD_ID = child.THREAD_ID
  5.   AND parent.EVENT_ID < child.EVENT_ID
  6.   AND (
  7.     child.EVENT_ID <= parent.END_EVENT_ID
  8.     OR parent.END_EVENT_ID IS NULL
  9.   );

The query for session B should show statement [2] as owning a data lock on the record with pk=1.

If session A executes more statements, [2] fades out of the history table.

The query should show the transaction that started in [1], regardless of how many statements, stages, or waits were executed.

To see more data, you can also use the events_xxx_history_long tables, except for transactions, assuming no other query runs in the server (so that history is preserved).


Suchen Sie im MySQL-Handbuch

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 26/06/2006, zuletzt geändert 26/10/2018
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/mysql-rf-performance-schema-obtaining-parent-events.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:en Manuel MySQL : https://dev.mysql.com/

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.

Inhaltsverzeichnis Haut