The most useful artifact for debugging is the **compiled SQL**.

## Capture Compiled SQL

- Use `--dry-run` when available to inspect generated SQL.
- In services, log:
  - the semantic query inputs
  - the resolved models/dimensions/metrics
  - the compiled SQL

## Instrumentation Comments

Sidemantic can include `-- sidemantic:` comments in compiled SQL. These are used by [Pre-Agg Recommendations](preagg-recommendations).

## Debug Workflow

1. Reproduce the semantic query.
2. Inspect compiled SQL.
3. Validate join path and metric aggregation strategy.
4. Compare to a baseline query at a known grain.