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:
Which one should I choose?
This may need to be renamed (or not) a few years later, when switching it to a materialized view:
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.
Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.
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:
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0