A very important statement in Vertica is the comment on statement, this statement allows you to create a sort of extended proprieties on the objects you create in the database.
Among this objects are:
- you can comment on:
COLUMN
CONSTRAINT
FUNCTION
LIBRARY
NODE
PROJECTION
SCHEMA
SEQUENCE
TABLE
TRANSFORM FUNCTION
VIEW
The advantage of using the comment statement/extended properties is that the documentation, notes, and so on stay with the databases and can be used as a "live documentation" mechanism. They are backed up with the database, and scripted out with the build scripts.
Let's go and see some examples of how we can add comments to our objects.
Add comment to a schema:
Add comment on a table
Add comment on a projection
Add comment on a column
you must associate the projection name and column name;
Also is important to know how to remove a comment from an object.
once the object has been removed the comments also will be removed.
To remove the comment from a schema for example:
To get a full list of your comments query the v_catalog.comments table.
I find this very useful as i really don't remember what is what after a few months in a project and also this statement allows me create a better bound while working with other DBA's.
Of course, ultimately, comment statement/extended properties are just one of the various means of ensuring that your databases are well-documented and easily understood, such as using long descriptive object names.