SHOW-QUERY-PROFILE

Name

SHOW QUERY PROFILE

Description

该语句是用来查看QUERY操作的树状Profile信息,该功能需要用户打开 Profile 设置,0.15 之前版本执行下面的设置:

  1. SET is_report_success=true;

0.15 及之后的版本执行下面的设置:

  1. SET [GLOBAL] enable_profile=true;

语法:

  1. show query profile "/";

这个命令会列出当前保存的所有query操作的 Profile 。

  1. show query profile "/queryId"\G;
  2. show query profile "/queryId/fragment_id/instance_id";

获取指定query id树状profile信息,返回profile 简易树形图。指定fragment_id和instance_id则返回对应的详细profile树形图。

Example

  1. 列出所有的 query Profile

    1. mysql> show query profile "/";
    2. +-----------------------------------+------+-------------------------+--------------------+-----------+---------------------+---------------------+-----------+------------+
    3. | QueryId | User | DefaultDb | SQL | QueryType | StartTime | EndTime | TotalTime | QueryState |
    4. +-----------------------------------+------+-------------------------+--------------------+-----------+---------------------+---------------------+-----------+------------+
    5. | 327167e0db4749a9-adce3b3d770b2bb1 | root | default_cluster:test_db | select * from test | Query | 2022-08-09 10:50:09 | 2022-08-09 10:50:09 | 19ms | EOF |
    6. +-----------------------------------+------+-------------------------+--------------------+-----------+---------------------+---------------------+-----------+------------+
    7. 1 row in set (0.00 sec)
  2. 列出指定QueryId的 query Profile

    1. mysql> show query profile "/327167e0db4749a9-adce3b3d770b2bb1"\G
    2. *************************** 1. row ***************************
    3. Fragments: ┌────────────────────────┐
    4. │[-1: VDataBufferSender]
    5. Fragment: 0
    6. MaxActiveTime: 783.263us
    7. └────────────────────────┘
    8. ┌┘
    9. ┌───────────────────┐
    10. │[1: VEXCHANGE_NODE]│
    11. Fragment: 0
    12. └───────────────────┘
    13. └┐
    14. ┌────────────────────────┐
    15. │[1: VDataStreamSender]
    16. Fragment: 1
    17. MaxActiveTime: 847.612us
    18. └────────────────────────┘
    19. ┌────────────────────┐
    20. │[0: VOLAP_SCAN_NODE]│
    21. Fragment: 1
    22. └────────────────────┘
    23. ┌┘
    24. ┌─────────────┐
    25. │[OlapScanner]│
    26. Fragment: 1
    27. └─────────────┘
    28. ┌─────────────────┐
    29. │[SegmentIterator]│
    30. Fragment: 1
    31. └─────────────────┘
    32. 1 row in set (0.00 sec)
  3. 列出指定 Fragment 的 Instance 概况

    1. mysql> show query profile "/327167e0db4749a9-adce3b3d770b2bb1/1/"\G
    2. *************************** 1. row ***************************
    3. Instances: 327167e0db4749a9-adce3b3d770b2bb2
    4. Host: 172.26.0.1:9111
    5. ActiveTime: 847.612us
    6. 1 row in set (0.01 sec)
  4. 继续查看某一个具体的 Instance 上各个算子的详细 Profile

    1. mysql> show query profile "/327167e0db4749a9-adce3b3d770b2bb1/1/327167e0db4749a9-adce3b3d770b2bb2"\G
    2. *************************** 1. row ***************************
    3. Instance: ┌───────────────────────────────────────┐
    4. │[1: VDataStreamSender]
    5. │(Active: 36.944us, non-child: 0.20)
    6. - Counters:
    7. - BytesSent: 0.00
    8. - IgnoreRows: 0
    9. - LocalBytesSent: 20.00 B
    10. - OverallThroughput: 0.0 /sec
    11. - PeakMemoryUsage: 0.00
    12. - SerializeBatchTime: 0ns
    13. - UncompressedRowBatchSize: 0.00
    14. └───────────────────────────────────────┘
    15. ┌───────────────────────────────────────┐
    16. │[0: VOLAP_SCAN_NODE]
    17. │(Active: 563.241us, non-child: 3.00)
    18. - Counters:
    19. - BatchQueueWaitTime: 444.714us
    20. - BytesRead: 37.00 B
    21. - NumDiskAccess: 1
    22. - NumScanners: 2
    23. - PeakMemoryUsage: 320.00 KB
    24. - RowsRead: 4
    25. - RowsReturned: 4
    26. - RowsReturnedRate: 7.101K /sec
    27. - ScannerBatchWaitTime: 206.40us
    28. - ScannerSchedCount : 2
    29. - ScannerWorkerWaitTime: 34.640us
    30. - TabletCount : 2
    31. - TotalReadThroughput: 0.0 /sec
    32. └───────────────────────────────────────┘
    33. ┌─────────────────────────────────┐
    34. │[OlapScanner]
    35. │(Active: 0ns, non-child: 0.00)
    36. - Counters:
    37. - BlockConvertTime: 0ns
    38. - BlockFetchTime: 183.741us
    39. - ReaderInitTime: 180.741us
    40. - RowsDelFiltered: 0
    41. - RowsPushedCondFiltered: 0
    42. - ScanCpuTime: 388.576us
    43. - ScanTime: 0ns
    44. - ShowHintsTime_V1: 0ns
    45. └─────────────────────────────────┘
    46. ┌─────────────────────────────────────┐
    47. │[SegmentIterator]
    48. │(Active: 0ns, non-child: 0.00)
    49. - Counters:
    50. - BitmapIndexFilterTimer: 124ns
    51. - BlockLoadTime: 179.202us
    52. - BlockSeekCount: 5
    53. - BlockSeekTime: 18.792us
    54. - BlocksLoad: 4
    55. - CachedPagesNum: 2
    56. - CompressedBytesRead: 0.00
    57. - DecompressorTimer: 0ns
    58. - IOTimer: 0ns
    59. - IndexLoadTime_V1: 0ns
    60. - NumSegmentFiltered: 0
    61. - NumSegmentTotal: 2
    62. - RawRowsRead: 4
    63. - RowsBitmapIndexFiltered: 0
    64. - RowsBloomFilterFiltered: 0
    65. - RowsConditionsFiltered: 0
    66. - RowsKeyRangeFiltered: 0
    67. - RowsStatsFiltered: 0
    68. - RowsVectorPredFiltered: 0
    69. - TotalPagesNum: 2
    70. - UncompressedBytesRead: 0.00
    71. - VectorPredEvalTime: 0ns
    72. └─────────────────────────────────────┘
    73. 1 row in set (0.01 sec)

Keywords

  1. SHOW, QUERY, PROFILE

Best Practice