mariadb get query exec time

From Onset Developer Wiki
mariadb get query exec time

Type: Function
Context: Server
Introduced: v1.0

NOTICE

This function is provided by the official MariaDB plugin.

Description

Gets the time in milliseconds how long this query took to execute.

Syntax

mariadb_get_query_exec_time()

Parameters

  • This function has no parameters.

Return Value

  • Returns the execution time in milliseconds.

Example

function LoadVehicle()
    local query = mariadb_prepare(sql, "SELECT * FROM vehicles WHERE id = 1;")
    mariadb_async_query(sql, query, OnLoadVehicle)
end

function OnLoadVehicle()
    local time = mariadb_get_query_exec_time()
    print("Query took: "..time.."ms")
end

See also