News, views, tips and tricks on Oracle and other fun stuff

Comments on Constraints and Indexes in the Database, a Good Idea?

Martin Widlake thinks so:

Comments are great, you can put 4000 characters of information into the database about each table, view and column. This can be a brief description of the object, a full explanation of what a column is to hold or even a list of typical entries for a column or table. But you can’t add a comment on indexes or constraints. Why would I want to? Well, constraints and indexes should only be there for a reason and the reason is not always obvious from either the names of the columns or the name of the constraint or index, especially where you have a naming standard that forces you to name indexes and constraints after the columns they reference.

He goes on to explain the advantages:

If I was able to add comments to constraints and indexes within the database then they would there. You move the system from one platform to the other, they are there. If for any wildly unlikely reason the central documentation lets you down, the information is always there in the database and easy to check. You may not be able to track down the original design documents but you have the database in front of you, so comments in that will persist and be very easy to find.

Martin raises very good points. I believe that it would be a useful feature to have in a future database version.

Filed in Oracle on 24 Jan 12 | Tags:

Reader's Comments

  1. |

    […] posted a comment on Martin’s blog, that I previously quoted, about a “hack” to add a comment on a default value definition. Here is an example of […]

  2. |

    Yes, it’s a good idea. I should be able to add comments about any database object.