Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / General DB Topics / DB Theory / December 2008

Tip: Looking for answers? Try searching our database.

Long column names...Performance issues?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
chenthorn - 19 Nov 2008 17:29 GMT
My group is working to create a new set of Db standards as we embark
upon redesigning our new web app backend db. The other architect wants
every table/column/variable name to be unabbreviated and as
descriptive as possible. This of course leads to long and ungainly
names. while this is all well and fine in theory, when writing a lot
of code, long column names are no fun and often lead to bugs due to
spelling errors (Not that I would know anything about that )

I would like to hear from the community what you all feel are best
practices regarding naming conventions, and how they affect your
environment.

Thanks in advance!
patrick61z@yahoo.com - 19 Nov 2008 19:26 GMT
> My group is working to create a new set of Db standards as we embark
> upon redesigning our new web app backend db. The other architect wants
[quoted text clipped - 9 lines]
>
> Thanks in advance!

I'm not an expert, I just like to post in newsgroups.

In my experience, naming debates can be a psychological pain in the
behind. (It could just be me tho.) What I like to do is make my naming
modular going from left to right so that the names sort but thats just
sort of a tiebreaker for me. Obviously the most important names in any
programming project are going to be the more public interfaces, like
modules that get referenced in many other modules, these are the ones
you want to name carefully if you can.

Long names would probably only impact performance slightly if your sql
is dynamically created and even then I don't see that names would be
so big that they'd even be a minute percentage of your performance
concerns. Since most sql is going to be compiled internally in your
sql server to be essentially numerically indexed objects, the actual
impact of naming is going to be in the self documenting nature of your
code and in that case its not so much the length of the names, its the
quality. On the other hand, you can get stuck psychologically trying
to find the best name for some wierd self referential variables that
are difficult to name because they have no non computer equivalent or
are incidental to the actual problem domain.

I remember one coder used to name his variables after random star trek
characters and episodes.
Gints Plivna - 19 Nov 2008 21:23 GMT
On 19 Nov., 21:26, patrick...@yahoo.com wrote:
> I remember one coder used to name his variables after random star trek
> characters and episodes.

He was somehow limited in his imagination. I think the very first
technique offered here http://www.web-hits.org/txt/codingunmaintainable.html
(New Uses For Names For Baby) is much better.

Gints Plivna
http://www.gplivna.eu
Brian Selzer - 19 Nov 2008 21:11 GMT
> My group is working to create a new set of Db standards as we embark
> upon redesigning our new web app backend db. The other architect wants
[quoted text clipped - 9 lines]
>
> Thanks in advance!

All I can say is "Waaah!"  If the variable names are descriptive, it's
easier to read code in order to figure out what it does.  The only bugs that
long names cause are the ones that are easiest to find: In most languages it
causes a compiler error (or can if the right options are selected).  It's a
lot harder to find a problem when the column name is PDATE and you don't
know whether PDATE is for Date Purchased or Date Picked.  What makes it
worse is when names are reused or code is combined and the comments that
tell you what PDATE is for aren't updated.  I would much rather spend a few
extra seconds keying in a long and descriptive name than several extra hours
trying to figure out what a piece of code is supposed to do or several extra
days trying to chase down a bug.
Gints Plivna - 19 Nov 2008 21:15 GMT
> I would like to hear from the community what you all feel are best
> practices regarding naming conventions, and how they affect your
> environment.

I'd say that naming has (almost) nothing to do with performance of
code, but it definitely has something to do with performance of coders
producing the code. Even with gui tools suggesting variants and
helping people not so familiar with schema it is hard to write
ThisLongAndWindyVariableNameExactlyDescribingWhatIsItsMainGoalAndExplainingWhyItWasCreatedAsWellAsAddingSomeOtherInfo.
On the other hand writing just i, j, k, l, m, n is also very dangerous
because it is hard to understand why these were creted, for what used
etc etc.
So the problem of course is to find where the golden mean lies. I'm
quite sure it doesn't matter where it is exactly for you/your project
but there is one thing which matters - stick with your standards. At
least in your project. It is hard to work with code having variables:
a
ANEWVARIABLE
A_NEW_VARIABLE
a_New_Variable
a_new_variable
v_a_new_variable
ANewVariable
etc
So stick with one standard and use it. My favourite is here
http://www.gplivna.eu/papers/naming_conventions.htm yours may be
somewhere else :)

Gints Plivna
http://www.gplivna.eu
Walter Mitty - 21 Nov 2008 19:50 GMT
>> I would like to hear from the community what you all feel are best
>> practices regarding naming conventions, and how they affect your
[quoted text clipped - 9 lines]
> etc etc.
> So the problem of course is to find where the golden mean lies.

I think you're onto something with the "golden mean".  I think the term
"decriptive" might be replaced by the term "mnemonic".  The purpose isn't so
much to  describe the table or column via its name, but rather to allow the
name to trigger an association for the human reader (presumably a
programmer) who has previously been exposed to a description.

In assembly language, the opcode "103" carries almost no mnemonic value at
all.  The symbolic opcode "a" might carry a little mnemonic value.  The
opcode "add" carries a lot more.  In this case, the time needed to type the
extra two letters without error is trivial compared to the chance of
mistyping the opcode "a" instead of the opcode "s", or the time needed to
remember that "a" stands for addition and not appending.   In terms of
column names,  "ID" carries almost no mnemonic value.  "EmpID" carries a
little more,  and "EmployeeID" carries even more than that.

One quibble:  validating the longer table and column names, and filling in
long names based on fewer keystrokes,  requires access to a copy of the
metadata stored in the database data dictionary.  A compiler cannot check
these names the same way it checks program variable names.

Another point:  most of us resort to very abbreviated names for table
aliases and column aliases.  The lexical scope of these aliases is so small
that making them mnemonic would hardly be worth the effort.

You are right about the performance issues being next to nothing.
Especially if the long names are parsed and bound prior to execution.
Ed Prochak - 05 Dec 2008 19:07 GMT
[]
> So the problem of course is to find where the golden mean lies. I'm
> quite sure it doesn't matter where it is exactly for you/your project
[quoted text clipped - 12 lines]
>
> Gints Plivnahttp://www.gplivna.eu

You had me until the suggestion that all tables should have surrogate
ID primary Keys. Otherwise I think your suggestions look good.

 Ed
Gints Plivna - 05 Dec 2008 21:25 GMT
> You had me until the suggestion that all tables should have surrogate
> ID primary Keys. Otherwise I think your suggestions look good.

Several years ago I was more categoric about these things, today I'd
say that wahtever suits one better is OK, however I personally stick
to surrogates for new apps anyway :)

Gints Plivna
http://www.gplivna.eu
Bob Badour - 05 Dec 2008 21:34 GMT
>>You had me until the suggestion that all tables should have surrogate
>>ID primary Keys. Otherwise I think your suggestions look good.
>
> Several years ago I was more categoric about these things, today I'd
> say that wahtever suits one better is OK, however I personally stick
> to surrogates for new apps anyway :)

That's a non-answer if I ever heard one. The design criteria for primary
keys are uniqueness, irreducibility, familiarity, stability and
simplicity -- not necessarily in that order. The criteria frequently
contradict one another requiring the designer to make tradeoffs.

Your attitude basically says you don't have a clue how to do real design
so you use a simplistic rule instead. Evaluating designs and
understanding design tradeoffs is central to what we do.
Gints Plivna - 06 Dec 2008 17:41 GMT
> Your attitude basically says you don't have a clue how to do real design
> so you use a simplistic rule instead.

I'm not responding to personal attacks so go get somebody else for
your games ;)

Gints Plivna
http://www.gplivna.eu
Bob Badour - 06 Dec 2008 19:19 GMT
>>Your attitude basically says you don't have a clue how to do real design
>>so you use a simplistic rule instead.
>
> I'm not responding to personal attacks so go get somebody else for
> your games ;)

It's a factual observation. If you don't like it, I suppose you can
ignore it as it seems you are wont to do. Or you can change it. In the
end, the decision is entirely up to you.
Ed Prochak - 08 Dec 2008 15:15 GMT
> >>Your attitude basically says you don't have a clue how to do real design
> >>so you use a simplistic rule instead.
[quoted text clipped - 5 lines]
> ignore it as it seems you are wont to do. Or you can change it. In the
> end, the decision is entirely up to you.

Bob,
I've seen enough of Gints' posts to know he isn't clueless.

Personally I try to prod folks along to better designs, but I try to
avoid using a cattle prod. That usually only makes them angry.
 Ed
Bob Badour - 08 Dec 2008 15:50 GMT
>>>>Your attitude basically says you don't have a clue how to do real design
>>>>so you use a simplistic rule instead.
[quoted text clipped - 8 lines]
> Bob,
> I've seen enough of Gints' posts to know he isn't clueless.

And I've seen enough to know that he is and that he probably chooses to be.

> Personally I try to prod folks along to better designs, but I try to
> avoid using a cattle prod. That usually only makes them angry.
>   Ed

You do things your way, and I'll do things mine. Some people may be
helped by what you do. Some people may be helped by what I do. Isn't
diversity a wonderful thing?
toby - 19 Nov 2008 23:57 GMT
> My group is working to create a new set of Db standards as we embark
> upon redesigning our new web app backend db. The other architect wants
[quoted text clipped - 7 lines]
> practices regarding naming conventions, and how they affect your
> environment.

There is no impact on performance whatsoever, so you are free to
choose whatever naming convention makes your code most writable,
readable and maintainable.

> Thanks in advance!
chenthorn - 20 Nov 2008 17:29 GMT
> > My group is working to create a new set of Db standards as we embark
> > upon redesigning our new web app backend db. The other architect wants
[quoted text clipped - 15 lines]
>
> - Show quoted text -

Thank you all for your (mostly) helpful information. It would seem
that the consensus is that long table\variable\column names are no
hinderence to performance. I have to say that the only examples of
where it may become an issue are very few, and probably taken care of
in katmai, although I am not sure.
Here is what i found AGAINST long names:
1. Long names take up more room inside dynamic sql strings, forcing
authors to perform various workarounds. (not really a performance
issue, but an issue to coders anyways)
2. Longer names increase query parsing time. (probably not enough of a
bump to be noticable, but testing would be interesting, especially if
sproc has numerous recompiles).
3. XML output bloated when names used as tags.
4. Bloats data packet size when result set sent to client.

As I said, these issues are ones that I found through searching the
internet. I would be interested in hearing any feed back.
Thank you all again in advance!
toby - 20 Nov 2008 20:16 GMT
> > > My group is working to create a new set of Db standards as we embark
> > > upon redesigning our new web app backend db. The other architect wants
[quoted text clipped - 28 lines]
> bump to be noticable, but testing would be interesting, especially if
> sproc has numerous recompiles).

Not measurably.

> 3. XML output bloated when names used as tags.
> 4. Bloats data packet size when result set sent to client.

I find it impossible to believe any of this would have a measurable
impact.

Forget all speed and latency issues and focus on maintainability,
where you can really make a difference. This thread shows that micro-
optimisation is already costing you money and time!

> As I said, these issues are ones that I found through searching the
> internet. I would be interested in hearing any feed back.
> Thank you all again in advance!
Roy Hann - 20 Nov 2008 21:46 GMT
> Thank you all for your (mostly) helpful information. It would seem
> that the consensus is that long table\variable\column names are no
> hinderence to performance. I have to say that the only examples of
> where it may become an issue are very few, and probably taken care of
> in katmai, although I am not sure.
> Here is what i found AGAINST long names:
[snip]

> 2. Longer names increase query parsing time. (probably not enough of a
> bump to be noticable, but testing would be interesting, especially if
> sproc has numerous recompiles).

I will bet you a fancy dinner that the time needed for just one
additional disk I/O operation would swamp this cost.  There are really
just three things to think about: lock-contention, disk I/O, and network
I/O.  These are many orders of magnitude slower than parsing and
doing symbol table lookups. (In any case, backtracking to disambiguate
SQL can take a long time in the parser, as can re-writing
where-clauses in conjunctive normal form.  And then there is query
optimization too.)

If you can tell me you've reduced these WAY below "good enough" then I
will agree you could spend your free time tinkering with testing the
parsing time conjecture.  And then you can buy me my fancy dinner.

> 3. XML output bloated when names used as tags.

This one made me laugh out loud!  Do Hummer owners worry about the
weight of the smashed bugs on the windshield decreasing their fuel
economy?

> 4. Bloats data packet size when result set sent to client.

Irrelevant.  Modern networks send big packets very fast.  What will
kill you is if you try to send lots of packets; big or small, doesn't
matter.

> As I said, these issues are ones that I found through searching the
> internet. I would be interested in hearing any feed back.
> Thank you all again in advance!

The overriding concern should be with maintainability and clarity.
Choose names that help rather than hinder, and if they are long, so be
it.

Signature

Roy

DBMS_Plumber - 05 Dec 2008 21:40 GMT
SELECT
Opinions_We_Will_All_Come_To_Regret.Incoherent_Blathering_Studded_With_Meaningless_Buzzwords_And_Salted_with_Enough_Jargon_To_Make_You_Feel_Inadequate

 FROM Morons_Paid_Too_Much_By_Clueless_People,
           Opinions_We_Will_All_Come_To_Regret,
Ideas_Which_Are_Dead_But_Manage_Like_Zombies_To_Arise_And_Eat_The_Brains_Of_The_Living
WHERE
Morons_Paid_Too_Much_By_Clueless_People.Name_Used_For_Publicity_Purposes
=
Opinions_We_Will_All_Come_To_Regret.Name_Supplied_By_Admin_Assistant_When_A_Speaking_Slot_Openned_Up
    AND
Ideas_Which_Are_Dead_But_Manage_Like_Zombies_To_Arise_And_Eat_The_Brains_Of_The_Living.Term_Originally_Stolen_From_A_Distantly_Related_Discipline
IN
Opinions_We_Will_All_Come_To_Regret.The_List_Of_Things_Last_Weeks_Trade_Journals_Seemed_To_Be_Interested_In;
Roy Hann - 06 Dec 2008 08:25 GMT
> SELECT
> Opinions_We_Will_All_Come_To_Regret.Incoherent_Blathering_Studded_With_Meaningless_Buzzwords_And_Salted_with_Enough_Jargon_To_Make_You_Feel_Inadequate
[quoted text clipped - 10 lines]
> IN
> Opinions_We_Will_All_Come_To_Regret.The_List_Of_Things_Last_Weeks_Trade_Journals_Seemed_To_Be_Interested_In;

I am going to try to get someone to print that on a mug or a T-shirt!
:-)

Signature

Roy

-CELKO- - 21 Nov 2008 13:29 GMT
>>  I would like to hear from the community what you all feel are best practices regarding naming conventions, and how they affect your environment. <<

Get a few copies of SQL PROGRAMMING STYLE and use it to set shop
standards.  It is based on the ISO-11179 rules and research that we
did decades ago on code readability.  It also has the advantage of
being an outside source so you can avoid internal fights  -- blame
Celko instead of each other :).
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.