Code Quality
Querylab.io analyzes your SQL in real-time and highlights issues with colored underlines.
Severity Levels
| Color | Severity | Meaning |
|---|---|---|
| Red | Error | Query will fail — must fix |
| Orange | Warning | Cost/performance issue — should fix |
| Blue | Info | Potential improvement |
| Dotted | Hint | Optional optimization |
Hover over any underline to see details. Press Cmd+. (Mac) or Ctrl+. (Windows) for quick fixes.
Rules
Cost & Performance
- SELECT * on large table
- Large table scan without filters
- Missing partition filter
- Missing cluster filter
- Wildcard table scan without filter
- Wildcard table scan without _TABLE_SUFFIX (disabled)
- ORDER BY without LIMIT
- COUNT(DISTINCT) performance
- Suboptimal clustering order
JOIN Issues
- CROSS JOIN detected
- JOIN with OR condition
- Missing JOIN condition
- Ambiguous SELECT * with JOINs
NULL Handling
- NULL comparison with =
Column References
- Undefined column
- Column references without FROM clause
- Ambiguous column reference
- Duplicate column/alias
- Conflicting column and alias names
- USING clause references non-existent column
GROUP BY & Aggregation
- Non-aggregated column in GROUP BY
- HAVING without GROUP BY
- Aggregate in WHERE clause
- Nested aggregate functions
- SELECT * with GROUP BY
Window Functions
- Window function in WHERE
- QUALIFY without window function
CTEs
- Unused CTE
- Duplicate CTE name
- Undefined CTE references
- CTE shadows table (disabled)
ORDER BY
- ORDER BY column not in SELECT
- ORDER BY position out of range
- LIMIT without ORDER BY in subquery
Type Consistency
- String in numeric comparison
- CASE expression with inconsistent types
Subqueries
- Unnecessary subquery wrapping
- Scalar subquery returning multiple columns
- IN subquery returning multiple columns
Table & Alias References
- Undefined table alias
- Duplicate table aliases
- Invalid hierarchical naming (project.dataset.table)
Suggestions (lightbulb only)
- Suggest using QUALIFY clause
- Suggest GROUP BY ALL
- Suggest UNION BY NAME
Configuring Rules
Settings → Diagnostic Rules to enable/disable specific rules.