For the complete documentation index, see llms.txt. This page is also available as Markdown.

Query Statistics for MariaDB ColumnStore

Query statistics log MariaDB ColumnStore execution metrics (memory, I/O, cache) to infinidb_querystats; disabled by default and exposed via SHOW WARNINGS and calGetStats().

Description

In MariaDB ColumnStore, Query statistics (query stats) offer comprehensive metrics about query execution. These statistics log execution metrics, including memory usage, I/O, cache activity, and processing mode. They can be used to optimize ColumnStore workloads, identify bottlenecks, and evaluate query performance.

By default, query statistics are disabled. The setup and privileges described on this page are only required when this feature is explicitly enabled.

When query statistics are enabled:

  • ColumnStore collects query execution metrics.

  • The infinidb_querystats.querystats table contains statistics.

  • Additional query execution information are available through:

    • SHOW WARNINGS

    • calGetStats() function

When query statistics are enabled, system performance can be affected. See Performance Considerations.

Prerequisites

Before enabling query statistics, ensure the following requirements are met:

Enable Query Statistics

QueryStats is disabled by default. Query statistics are managed by the mcsSetConfig utility.

  1. In order to enable query statistics, run the following command:

  1. After enabling, restart the cluster or ColumnStore services to apply the changes:

  • Single-node setup: restart ColumnStore services

  • For multiple nodes: restart the ColumnStore cluster

Grant Required Privileges

QueryStats writes data to a system table using the internal utility user. To enable this, you must grant the INSERT privilege to the utility user with the following command:

Note: Replace utility_user'@'localhost with the actual username and host configured for your cross-engine join utility user.

This follows the principle of least privilege by granting access only to the required table.

Query Statistics Table

Query statistics are stored in the infinidb_querystats.querystats table.

Example

This table includes past query execution metrics for every session.

Retrieve Historical Query Statistics

To view historical query statistics:

This provides statistics for previously executed queries across sessions.

Retrieve Session-Level Statistics

To get statistics for the current session's most recent ColumnStore query, use the following function:

View Query Statistics Using SHOW WARNINGS

Each query generates a warning with execution metrics when query statistics are enabled.

Example

Output

To view the statistics:

Example output:

Performance Considerations

Enabling query statistics logs metrics for every query executed through ColumnStore can degrade performance by 10% or more.

ColumnStore logs calshowstats metrics for each query it processes when it is enabled. This is intended for debugging sessions, performance analysis, and bulk query evaluation, not for continuous use in production setups.

It is recommended to disable query statistics when active analysis is complete or only when needed.

See Also

This page is: Copyright © 2026 MariaDB. All rights reserved.

Last updated

Was this helpful?