- String literals are parsed, not pattern-matched
- The query is walked character by character while tracking quote state, so a literal like 'rate -- special' keeps its dashes and a value containing /* survives intact. Doubled quotes inside a literal, the SQL escape convention, are handled correctly.
- Both comment styles are removed
- Line comments from -- to end of line and block comments between /* and */ are both stripped, and each is replaced with a single space so tokens on either side do not merge into one identifier.
- Minifying loses documentation permanently
- Comments frequently carry the reason a query is written a particular way, an index hint, a workaround, a business rule. Keep the formatted version as your source of truth and treat the minified form as generated output.
- Performance is unaffected
- Whitespace and comments are discarded by the SQL parser before planning, so a minified query executes identically. The benefit is purely in transport and embedding, not speed.