Loading...

verticapy.performance.vertica.qprof_interface.QueryProfilerInterface.get_qexecution#

QueryProfilerInterface.get_qexecution(node_name: None | str | list = None, metric: Literal['all', 'exec_time_ms', 'est_rows', 'proc_rows', 'prod_rows', 'rle_prod_rows', 'clock_time_us', 'cstall_us', 'pstall_us', 'mem_res_mb', 'mem_all_mb'] = 'exec_time_ms', path_id: int | None = None, kind: Literal['bar', 'barh', 'pie'] = 'pie', multi: bool = True, categoryorder: Literal['trace', 'category ascending', 'category descending', 'total ascending', 'total descending', 'min ascending', 'min descending', 'max ascending', 'max descending', 'sum ascending', 'sum descending', 'mean ascending', 'mean descending', 'median ascending', 'median descending'] = 'max descending', rows: int = 3, cols: int = 3, show: bool = True, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure | vDataFrame#

Returns the Query execution chart.

Parameters#

node_name: str | list, optional

Node(s) name(s). It can be a simple node str or a list of nodes. If empty, all the nodes are used.

metric: str, optional

Metric to use. One of the following: - all (all metrics are used). - exec_time_ms (default) - est_rows - proc_rows - prod_rows - rle_prod_rows - clock_time_us - cstall_us - pstall_us - mem_res_mb - mem_all_mb

path_id: str

Path ID.

kind: str, optional

Chart Type.

  • bar:

    Drilldown Bar Chart.

  • barh:

    Horizontal Drilldown Bar Chart.

  • pie:

    Pie Chart.

multi: bool, optional

If set to True, a multi variable chart is drawn by using ‘operator_name’ and ‘path_id’. Otherwise, a single plot using ‘operator_name’ is drawn.

categoryorder: str, optional

How to sort the bars. One of the following options:

  • trace (no transformation)

  • category ascending

  • category descending

  • total ascending

  • total descending

  • min ascending

  • min descending

  • max ascending

  • max descending

  • sum ascending

  • sum descending

  • mean ascending

  • mean descending

  • median ascending

  • median descending

rows: int, optional

Only used when metric='all'. Number of rows of the subplot.

cols: int, optional

Only used when metric='all'. Number of columns of the subplot.

show: bool, optional

If set to True, the Plotting object is returned.

**style_kwargs

Any optional parameter to pass to the plotting functions.

Returns#

obj

Plotting Object.

Examples#

First, let’s import the QueryProfiler object.

from verticapy.performance.vertica import QueryProfiler

Then we can create a query:

qprof = QueryProfiler(
    "select transaction_id, statement_id, request, request_duration"
    " from query_requests where start_timestamp > now() - interval'1 hour'"
    " order by request_duration desc limit 10;"
)

To get node-wise performance information, get_qexecution can be used:

qprof.get_qexecution()

Note

To use one specific node:

qprof.get_qexecution(
    node_name = "v_vdash_node0003",
    metric = "exec_time_ms",
    kind = "pie",
)

To use multiple nodes:

qprof.get_qexecution(
    node_name = [
        "v_vdash_node0001",
        "v_vdash_node0003",
    ],
    metric = "exec_time_ms",
    kind = "pie",
)

The node name is different for different configurations. You can search for the node names in the full report.

Note

For more details, please look at QueryProfiler.