Loading...

verticapy.performance.vertica.qprof_interface.QueryProfilerInterface.get_qduration

QueryProfilerInterface.get_qduration(unit: Literal['s', 'm', 'h'] = 's') float

Returns the Query duration.

Parameters

unit: str, optional

Time Unit.

  • s:

    second

  • m:

    minute

  • h:

    hour

Returns

float

Query duration.

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 get the execution time by:

qprof.get_qduration(unit = "s")
Out[4]: 8.376614

Note

For more details, please look at QueryProfiler.