# Insights

> Aggregated analytics over query history — most-used tables, columns, and query patterns.

| | |
|---|---|
| **Routes** | `/insights` |
| **Feature id** | `insights` |
| **Default access** | `public` |
| **Requires auth** | No (set `CHM_FEATURE_INSIGHTS_ACCESS=authenticated` to gate) |
| **System tables** | `system.query_log` |
| **ClickHouse grants** | `SELECT` on `system.query_log` |

## What it does

Insights aggregates `system.query_log` to surface patterns across your workload: which tables are queried most often, which columns appear most in filters and projections, and how query activity breaks down over time.

Use Insights to answer questions like:

- Which tables get the most read queries?
- Which columns are used most in WHERE clauses?
- Has query volume changed significantly in the past day?

The page combines a stats grid (summary counts and rates) with chart sections that visualize trends over configurable time ranges.

## Pages

| Page | Route | What it shows | System tables |
|---|---|---|---|
| Insights | `/insights` | Top tables, top columns, query activity charts | `system.query_log` |

## Permissions & access

Disable:

```bash
CHM_FEATURE_INSIGHTS_ENABLED=false
```

Require authentication:

```bash
CHM_FEATURE_INSIGHTS_ACCESS=authenticated
```

Config file:

```toml
[features.insights]
enabled = true
access = "authenticated"
```

## Configuration

No feature-specific configuration. Query history depth depends on your ClickHouse `query_log` retention (`TTL` on the table). The default ClickHouse retention is 30 days.

## Notes & limitations

- All data comes from `system.query_log`. If query logging is disabled on the ClickHouse server, this page shows no data.
- Queries that failed before logging (e.g., parse errors) may not appear.
- Very high-throughput clusters can have large `query_log` tables; queries on this page include `LIMIT` clauses to keep response times reasonable.

## Related

- [Queries](/features/queries)
- [Feature permissions](/advanced/feature-permissions)
- [ClickHouse system.query_log docs](https://clickhouse.com/docs/en/operations/system-tables/query_log)
