Unformatted SQL — a 400-character single line from your logs, an ORM dump with random indentation — slows down everyone who reads it. Formatting is a solved problem: paste it into a formatter, pick a style, move on.
[dbdiagramr's free SQL formatter](https://www.dbdiagramr.space/sql-formatter) formats PostgreSQL in your browser. Uppercase or lowercase keywords, 2 or 4 space indent, copy or download. Nothing is uploaded.
Same query. The second version shows the misplaced JOIN or wrong GROUP BY in seconds; the first hides it.
Uppercase vs lowercase keywords
There is no technical difference — Postgres parses both identically. It is purely culture:
- **UPPERCASE** — traditional DBA style, SQL Server and Oracle shops, certification materials. Keywords visually pop against table names.
- **lowercase** — modern analytics style (dbt, Postgres-first teams). Less shouting, easier to type.
Pick the one that matches your codebase and enforce it with a formatter, not a style doc nobody reads.
Where formatting pays off most
- **Migration PRs** — formatted DDL diffs review in minutes; single-line dumps review never.
- **Log triage** — paste the slow query from pg_stat_statements or your app logs and read it.
- **Onboarding** — new hires can read the schema migrations as documentation.
- **Before diagramming** — clean SQL is easier to sanity-check before you [visualize it as an ER diagram](https://www.dbdiagramr.space/visualize).
FAQ
**Does formatting change what my query does?**No. A formatter only changes whitespace and keyword casing. Same semantics, better manners.
**Can I format SELECT queries or only DDL?**Both — SELECTs, CTEs, JOINs, migrations, anything valid PostgreSQL.
**Is my SQL sent to a server?**Not with dbdiagramr's formatter — it runs entirely in your browser.
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Top comments (0)