Loading...

verticapy.performance.vertica.qprof_interface.QueryProfilerInterface.get_qplan_profile#

QueryProfilerInterface.get_qplan_profile(unit: Literal['s', 'm', 'h'] = 's', kind: Literal['bar', 'barh', 'pie'] = 'pie', categoryorder: Literal['trace', 'category ascending', 'category descending', 'total ascending', 'total descending'] = 'total descending', show: bool = True, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure | vDataFrame#

Returns the Query Plan chart.

Parameters#

unit: str, optional

Unit used to draw the chart.

  • s:

    second.

  • m:

    minute.

  • h:

    hour.

kind: str, optional

Chart Type.

  • bar:

    Bar Chart.

  • barh:

    Horizontal Bar Chart.

  • pie:

    Pie Chart.

categoryorder: str, optional

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

  • trace (no transformation)

  • category ascending

  • category descending

  • total ascending

  • total 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;"
)

We can visualize the query plan profile:

qprof.get_qplan_profile(kind="pie")

Note

For more details, please look at QueryProfiler.