Query Review

Review SQL For Meaning, Not Only Syntax

Every risky line gets a Query Receipt annotation in the margin — Base Grain Changed, Fanout Introduced, Filter Applied After Aggregation, Distinct Hides Duplication, Time Grain Shifted. Compare two receipts (before vs after) to tell an intentional business change from an accidental grain error.

SELECT c.customer_id, SUM(i.amount) AS mrr
FROM customers cBase Grain Changed
JOIN contacts x ON x.customer_id = c.customer_idFanout Introduced
JOIN invoices i ON i.customer_id = c.customer_id
WHERE c.plan = 'enterprise'Filter Applied After Aggregation
GROUP BY c.customer_idDistinct Hides Duplication
HAVING SUM(i.amount) > 0 -- as of this monthTime Grain Shifted
Row count6,412 → 14,738+130%

Receipt itemized — Open Grain Annotation on any tagged line for the full explanation.

  • Review Query — paste or connect a query for grain review
  • Open Grain Annotation — read why one line changed the grain
  • Compare Query Versions — before vs. after a proposed edit
  • Suggest Safe Rewrite — AI-proposed fix that preserves intent
  • Approve Review — sign off before the query ships
A Correct Query Can Still Produce The Wrong Metric.

Illuminate The True Grain Of Every Metric.

GrainLux is the AI Semantic Data Reliability Layer between your warehouse and every model, metric, and dashboard built on top of it — grain-aware, metric-native, explainable, and deterministic.