Skip to main content

Analytics Quick Reference

Essential Query Patterns

Usage Analytics

Use for: High-level usage metrics and health monitoring

User Analytics

Use for: Understanding user behavior and identifying power users

Keyspace Analytics

Use for: Comparing keyspace performance and usage

Billing Queries

Use for: Usage-based billing and credit tracking

Tag-Based Filtering

Use for: Custom metadata filtering and endpoint analysis

Filling Gaps in Time Series

Use for: Charts and visualizations that need consistent time intervals
See Query Examples - WITH FILL for hourly, daily, and monthly examples with outcome breakdowns.

Table Selection Guide

Choose the right table based on your time range: Performance Tips:
  • Always filter by time first (uses indexes)
  • Use SUM(count) with aggregated tables, not COUNT(*)
  • Add LIMIT clauses to prevent large result sets
  • Filter before grouping when possible

Common Filters

Automatic filtering: All queries are automatically filtered based on your root key permissions:
  • Workspace: All queries are scoped to your workspace (no need to filter workspace_id)
  • API: If your root key is scoped to a specific API (api.<api_id>.read_analytics), queries are filtered to that API’s key_space_id. With api.*.read_analytics permissions, filter by key_space_id yourself.

Time Ranges

User & Keyspace Filters

Tag Filters

Outcome Filters

Need More Functions?

ClickHouse Function Reference
ClickHouse SQL Documentation
Last modified on June 2, 2026