Skip to content

Query Statistics API

This page documents the arcticdb.toolbox.query_stats module. This module provides utilities for collecting query statistics in ArcticDB.

Warning: This API is unstable and not governed by ArcticDB's semantic versioning. It may change or be removed in future versions without notice.

arcticdb.toolbox.query_stats

Query Statistics API for ArcticDB.

This module provides utilities for collecting query statistics.

.. warning:: This API is unstable and not governed by ArcticDB's semantic versioning. It may change or be removed in future versions without notice.

FUNCTION DESCRIPTION
disable

Disable query statistics collection.

enable

Enable query statistics collection.

get_query_stats

Get collected query statistics.

query_stats

Context manager for enabling query statistics collection within a specific scope.

reset_stats

Reset all collected query statistics.

disable

disable() -> None

Disable query statistics collection.

Stops collecting statistics for subsequent operations. Previously collected statistics remain available via get_query_stats().

.. warning:: This API is unstable and not governed by semantic versioning.

enable

enable() -> None

Enable query statistics collection.

Once enabled, statistics will be collected for operations performed until disable() is called or the context manager exits.

.. warning:: This API is unstable and not governed by semantic versioning.

get_query_stats

get_query_stats() -> Dict[str, Any]

Get collected query statistics.

Returns: Dict[str, Any]: A dictionary containing statistics organized by key type, operation group, and task type. Each task contains timing and count information.

Example output: { "storage_operations": { "S3_ListObjectsV2": { "total_time_ms": 83, "count": 3 }, "S3_GetObject": { "total_time_ms": 50, "count": 3, "size_bytes": 10 } } }

.. warning:: This API is unstable and not governed by semantic versioning.

query_stats

query_stats() -> Iterator[None]

Context manager for enabling query statistics collection within a specific scope.

When entering the context, query statistics collection is enabled. When exiting the context, it is automatically disabled.

Raises: UserInputException: If query stats is already enabled.

Example: >>> with query_stats(): ... store.list_symbols()

.. warning:: This API is unstable and not governed by semantic versioning.

reset_stats

reset_stats() -> None

Reset all collected query statistics.

This clears all statistics that have been collected since enabling the query statistics collection.

.. warning:: This API is unstable and not governed by semantic versioning.