Query Profile Action

Request

GET /rest/v2/manager/query/query_info

GET /rest/v2/manager/query/sql/{query_id}

GET /rest/v2/manager/query/profile/text/{query_id}

GET /rest/v2/manager/query/profile/fragments/{query_id}

GET /rest/v2/manager/query/profile/graph/{query_id}

Get the query information

GET /rest/v2/manager/query/query_info

Description

Gets information about select queries for all fe nodes in the cluster.

Query parameters

  • query_id

    Optional, specifies the query ID of the query to be returned, default returns information for all queries.

  • search

    Optional, specifies that query information containing strings is returned, currently only string matches are performed.

  • is_all_node

    Optional, if true, returns query information for all fe nodes, if false, returns query information for the current fe node. The default is true.

Response

  1. {
  2. "msg": "success",
  3. "code": 0,
  4. "data": {
  5. "column_names": [
  6. "Query ID",
  7. "FE节点",
  8. "查询用户",
  9. "执行数据库",
  10. "Sql",
  11. "查询类型",
  12. "开始时间",
  13. "结束时间",
  14. "执行时长",
  15. "状态"
  16. ],
  17. "rows": [
  18. [
  19. ...
  20. ]
  21. ]
  22. },
  23. "count": 0
  24. }

Examples

  1. GET /rest/v2/manager/query/query_info
  2. {
  3. "msg": "success",
  4. "code": 0,
  5. "data": {
  6. "column_names": [
  7. "Query ID",
  8. "FE节点",
  9. "查询用户",
  10. "执行数据库",
  11. "Sql",
  12. "查询类型",
  13. "开始时间",
  14. "结束时间",
  15. "执行时长",
  16. "状态"
  17. ],
  18. "rows": [
  19. [
  20. "d7c93d9275334c35-9e6ac5f295a7134b",
  21. "127.0.0.1:8030",
  22. "root",
  23. "default_cluster:testdb",
  24. "select c.id, c.name, p.age, p.phone, c.date, c.cost from cost c join people p on c.id = p.id where p.age > 20 order by c.id",
  25. "Query",
  26. "2021-07-29 16:59:12",
  27. "2021-07-29 16:59:12",
  28. "109ms",
  29. "EOF"
  30. ]
  31. ]
  32. },
  33. "count": 0
  34. }

Get the sql and text profile for the specified query

GET /rest/v2/manager/query/sql/{query_id}

GET /rest/v2/manager/query/profile/text/{query_id}

Description

Get the sql and profile text for the specified query id.

Path parameters

  • query_id

    The query id.

Query parameters

  • is_all_node

    Optional, if true then query for the specified query id in all fe nodes, if false then query for the specified query id in the currently connected fe nodes. The default is true.

Response

  1. {
  2. "msg": "success",
  3. "code": 0,
  4. "data": {
  5. "sql": ""
  6. },
  7. "count": 0
  8. }
  1. {
  2. "msg": "success",
  3. "code": 0,
  4. "data": {
  5. "profile": ""
  6. },
  7. "count": 0
  8. }

Examples

  1. get sql.

    1. GET /rest/v2/manager/query/sql/d7c93d9275334c35-9e6ac5f295a7134b
    2. Response:
    3. {
    4. "msg": "success",
    5. "code": 0,
    6. "data": {
    7. "sql": "select c.id, c.name, p.age, p.phone, c.date, c.cost from cost c join people p on c.id = p.id where p.age > 20 order by c.id"
    8. },
    9. "count": 0
    10. }

Get the specified query fragment and instance information

GET /rest/v2/manager/query/profile/fragments/{query_id}

Description

Get the fragment name, instance id and execution time for the specified query id.

Path parameters

  • query_id

    The query id.

Query parameters

  • is_all_node

    Optional, if true then query for the specified query id in all fe nodes, if false then query for the specified query id in the currently connected fe nodes. The default is true.

Response

  1. {
  2. "msg": "success",
  3. "code": 0,
  4. "data": [
  5. {
  6. "fragment_id": "",
  7. "time": "",
  8. "instance_id": {
  9. "": ""
  10. }
  11. }
  12. ],
  13. "count": 0
  14. }

Examples

  1. GET /rest/v2/manager/query/profile/fragments/d7c93d9275334c35-9e6ac5f295a7134b
  2. Response:
  3. {
  4. "msg": "success",
  5. "code": 0,
  6. "data": [
  7. {
  8. "fragment_id": "0",
  9. "time": "36.169ms",
  10. "instance_id": {
  11. "d7c93d9275334c35-9e6ac5f295a7134e": "36.169ms"
  12. }
  13. },
  14. {
  15. "fragment_id": "1",
  16. "time": "20.710ms",
  17. "instance_id": {
  18. "d7c93d9275334c35-9e6ac5f295a7134c": "20.710ms"
  19. }
  20. },
  21. {
  22. "fragment_id": "2",
  23. "time": "7.83ms",
  24. "instance_id": {
  25. "d7c93d9275334c35-9e6ac5f295a7134d": "7.83ms"
  26. }
  27. }
  28. ],
  29. "count": 0
  30. }

Get the specified query id tree profile information

GET /rest/v2/manager/query/profile/graph/{query_id}

Description

Get the tree profile information of the specified query id, same as show query profile command.

Path parameters

  • query_id

    The query id.

Query parameters

  • fragment_id and instance_id

    Optional, both parameters must be specified or not.
    If both are not specified, a simple tree of profiles is returned, equivalent to show query profile '/query_id';
    If both are specified, a detailed profile tree is returned, which is equivalent to show query profile '/query_id/fragment_id/instance_id'.

  • is_all_node

    Optional, if true then query information about the specified query id in all fe nodes, if false then query information about the specified query id in the currently connected fe nodes. The default is true.

Response

  1. {
  2. "msg": "success",
  3. "code": 0,
  4. "data": {
  5. "graph":""
  6. },
  7. "count": 0
  8. }