SQL COMMENTS are non-executing text fragments inserted into SQL code to describe intent, disable portions of code, or leave metadata for future readers. The parser discards comment text before the statement reaches the optimizer, so comments have no impact on results or performance (except negligible parsing time). SQL supports two primary forms:1. Single-line comment that begins with two hyphens (--) and extends to the end of that line.2. Block or multi-line comment enclosed by /* and */.Placement is flexible: at the start, end, or inside a statement, between tokens. They can also appear in DDL objects like views, stored procedures, and functions. Most dialects do not allow nested block comments, and forgetting the closing */ causes a syntax error. Some vendors extend the block comment syntax for optimizer hints (e.g., /*+ hint */ in Oracle), so you must avoid leading plus signs unless intentionally providing a hint.
SQL HINTS, EXPLAIN, DEBUGGING SQL, VIEW definition comments
SQL-92
Start a single line with -- or wrap multiple lines between /* and */. The database will ignore that text.
No. Comments are removed during parsing and never reach the optimizer or executor.
Most databases do not support nested /* */ comments. Nesting causes a syntax error unless your dialect explicitly supports it (e.g., PL/SQL supports a variant).
Apart from a trivial increase in parsing time, comments have no measurable impact on execution speed.