2

My view stores quality metrics for various gizmos1 in the database. Today I designed it to be a view. In a few years, as we produce more gizmos, it may need to be changed to a materialized view.

I was thinking of naming the view either of these 3 ways:
gizmo_quality_metrics
gizmo_quality_metrics_v
v_gizmo_quality_metrics

Which one should I choose?

This may need to be renamed (or not) a few years later, when switching it to a materialized view:
gizmo_quality_metrics
gizmo_quality_metrics_mv
mv_gizmo_quality_metrics

From the way I worded the question, you get the idea that I favor keeping the same name (gizmo_quality_metrics), which is based on the data, and disregard the implementation (thus, no prefixes and extensions). However, I have seen all of the above naming conventions in practice, and I am wondering what is the most maintainable one for the long term.


1 I am simplifying - of course, they are not gizmos. They are actually deoxyribonucleic acid (DNA) molecules, if you really want to know. But this is irrelevant.


[EDIT, Mar 18, 2022]

Related question (thanks to a_horse_with_no_name for mentioning it!):
Is adding the ‘tbl’ prefix to table names really a problem?
Note that I do not link to any one particular answer in that literal wall of answers, from high to low rep users. It is instructive to read a few, though.

3
  • 1
    Naming conventions are largely a question of taste and style. And opinion-based questions are not a suitable here. The one important thing is to stay consistent. An inconsistent naming convention is often worse than none at all. To give my opinion: don't add any prefix or suffix. Especially since you intent to switch later. Mar 18, 2022 at 0:09
  • 1
    There you go. I also voted to close the question for said reason, no offense. Mar 18, 2022 at 1:29
  • 1
    Related: dba.stackexchange.com/questions/154251
    – user1822
    Mar 18, 2022 at 6:21

1 Answer 1

4

Naming conventions are largely a question of taste and style.

The one important thing is to stay consistent. An inconsistent naming convention is often worse than none at all. To give my opinion: don't add any prefix or suffix. Especially since you intend to switch later.

And always stick to legal, lower-case names. So you never have to double-quote. See:

Not the answer you're looking for? Browse other questions tagged or ask your own question.