COMMENT (formally COMMENT ON) attaches human-readable text to database objects such as tables, columns, views, indexes, schemas, and functions. The comment is stored in the system catalog so anyone querying metadata can see the description. It does not affect query execution, permissions, or storage size. Most modern engines persist the comment until it is explicitly changed or the object is dropped. Some dialects allow comments to be set inline during CREATE or ALTER statements (e.g., MySQL), while others use a dedicated COMMENT ON command (PostgreSQL, Oracle, Standard SQL). Comments can be queried through catalog views or information_schema. Because comments are metadata, they are included in logical backups but not always in physical dumps unless specified.
object_type
(keyword) - The kind of object to annotate (TABLE, COLUMN, VIEW, INDEX, SCHEMA, FUNCTION, etc.)object_name
(identifier) - Qualified name of the object being commented on. For columns use table_name.column_name.comment_text
(string) - The text of the comment. Use NULL to remove an existing comment.ALTER TABLE, DESCRIBE, INFORMATION_SCHEMA, EXTENDED PROPERTIES (SQL Server)
SQL-92 standard (COMMENT ON); earliest vendor implementation in Oracle 7
Most engines allow comments on tables and columns. PostgreSQL and Oracle also support schemas, views, indexes, sequences, materialized views, and functions.
No. Comments are purely metadata and have zero effect on query planning or execution speed.
Use catalog queries such as `SELECT obj_description('public.users'::regclass)` in PostgreSQL or query `information_schema.columns` in MySQL.
Set the comment text to NULL: `COMMENT ON TABLE public.users IS NULL;`