Documentation Home
MySQL 8.0 リファレンスマニュアル
Download this Manual
PDF (US Ltr) - 36.1Mb
PDF (A4) - 36.2Mb


このページは機械翻訳したものです。

28.4.5.17 ps_thread_trx_info() 関数

指定されたスレッドに関する情報を含む JSON オブジェクトを返します。 この情報には、現在のトランザクションと、パフォーマンススキーマ events_transactions_current および events_statements_history テーブルから導出された、すでに実行されているステートメントが含まれます。 (JSON オブジェクトの完全なデータを取得するには、これらのテーブルのコンシューマを有効にする必要があります。)

出力が切捨て長 (デフォルトで 65535) を超えると、次のような JSON エラーオブジェクトが返されます:

{ "error": "Trx info truncated: Row 6 was cut by GROUP_CONCAT()" }

関数の実行中に発生したその他の警告および例外についても、同様のエラーオブジェクトが返されます。

パラメータ
  • in_thread_id BIGINT UNSIGNED: トランザクション情報を返すスレッド ID。 この値は、一部のパフォーマンススキーマ threads テーブル行の THREAD_ID カラムと一致する必要があります。

構成オプション

ps_thread_trx_info() 操作は、次の構成オプションまたは対応するユーザー定義変数を使用して変更できます (セクション28.4.2.1「sys_config テーブル」 を参照):

  • ps_thread_trx_info.max_length, @sys.ps_thread_trx_info.max_length

    出力の最大長。 デフォルトは 65535 です。

戻り値

LONGTEXT 値。

mysql> SELECT sys.ps_thread_trx_info(48)\G
*************************** 1. row ***************************
sys.ps_thread_trx_info(48): [
  {
    "time": "790.70 us",
    "state": "COMMITTED",
    "mode": "READ WRITE",
    "autocommitted": "NO",
    "gtid": "AUTOMATIC",
    "isolation": "REPEATABLE READ",
    "statements_executed": [
      {
        "sql_text": "INSERT INTO info VALUES (1, \'foo\')",
        "time": "471.02 us",
        "schema": "trx",
        "rows_examined": 0,
        "rows_affected": 1,
        "rows_sent": 0,
        "tmp_tables": 0,
        "tmp_disk_tables": 0,
        "sort_rows": 0,
        "sort_merge_passes": 0
      },
      {
        "sql_text": "COMMIT",
        "time": "254.42 us",
        "schema": "trx",
        "rows_examined": 0,
        "rows_affected": 0,
        "rows_sent": 0,
        "tmp_tables": 0,
        "tmp_disk_tables": 0,
        "sort_rows": 0,
        "sort_merge_passes": 0
      }
    ]
  },
  {
    "time": "426.20 us",
    "state": "COMMITTED",
    "mode": "READ WRITE",
    "autocommitted": "NO",
    "gtid": "AUTOMATIC",
    "isolation": "REPEATABLE READ",
    "statements_executed": [
      {
        "sql_text": "INSERT INTO info VALUES (2, \'bar\')",
        "time": "107.33 us",
        "schema": "trx",
        "rows_examined": 0,
        "rows_affected": 1,
        "rows_sent": 0,
        "tmp_tables": 0,
        "tmp_disk_tables": 0,
        "sort_rows": 0,
        "sort_merge_passes": 0
      },
      {
        "sql_text": "COMMIT",
        "time": "213.23 us",
        "schema": "trx",
        "rows_examined": 0,
        "rows_affected": 0,
        "rows_sent": 0,
        "tmp_tables": 0,
        "tmp_disk_tables": 0,
        "sort_rows": 0,
        "sort_merge_passes": 0
      }
    ]
  }
]