Loading...

verticapy.performance.vertica.qprof.QueryProfiler.get_cpu_time#

QueryProfiler.get_cpu_time(kind: Literal['bar', 'barh'] = 'bar', reverse: bool = False, 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', show: bool = True, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure | vDataFrame#

Returns the CPU Time by node and path_id chart.

Parameters#

kind: str, optional

Chart Type.

  • bar:

    Bar Chart.

  • barh:

    Horizontal Bar Chart.

reverse: bool, optional

If set to True, the chart will be reversed.

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

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 visualize the CPU time spent by each node:

qprof.get_cpu_time(kind="bar")

Note

For more details, please look at QueryProfiler.