Analytics Quick Reference
Essential Query Patterns
Usage Analytics
Use for: High-level usage metrics and health monitoringUser Analytics
Use for: Understanding user behavior and identifying power usersKeyspace Analytics
Use for: Comparing keyspace performance and usageBilling Queries
Use for: Usage-based billing and credit trackingTag-Based Filtering
Use for: Custom metadata filtering and endpoint analysisFilling Gaps in Time Series
Use for: Charts and visualizations that need consistent time intervalsTable 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, notCOUNT(*) - Add
LIMITclauses 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’skey_space_id. Withapi.*.read_analyticspermissions, filter bykey_space_idyourself.
Time Ranges
User & Keyspace Filters
Tag Filters
Outcome Filters
Need More Functions?
→ ClickHouse Function Reference→ ClickHouse SQL Documentation