Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uppercase function names are faster than lowercase in Oracle?

I just listened a dba say that if you name all your functions, procedures etc in uppercase, the db will perform better when the workload in the database is high. Is this any true at all? I find that nearly impossible to believe. Is there any benchmark or something that prove him right or wrong?

I only think that this naming things have value when reading code, specially for a team. It is more likely that you can successfully modify code that is written following good writing conventions than just random stuff. But this has nothing to do with the computer performance, it should execute just the same.

Also, if it was like this, I should not be able to invoque a function named FUNC like func or Func or funC.

I think that statement is crazy, I'm I wrong? I mean, I'm not a database expert at all and he is a dba.

like image 692
Roger Avatar asked Mar 24 '23 10:03

Roger


2 Answers

By default, Oracle identifiers are case insensitive. Unless you explicitly create a case-sensitive function name (by enclosing the name in double quotes), which creates a host of issues none of which are related to performance, Oracle is going to store the function name in the data dictionary in upper case.

CREATE FUNCTION myFunction ...

CREATE FUNCTION MyFuNcTiOn ...

CREATE FUNCTION MYFUNCTION ..

CREATE FUNCTION myfunction ...

will all create a function that, in the data dictionary, is named MYFUNCTION in all upper case. You are free to call the function using whatever casing makes sense to you since it is a case insensitive identifier. The database has no idea what casing you used to create the function so it cannot possibly affect performance.

like image 107
Justin Cave Avatar answered Apr 06 '23 18:04

Justin Cave


The only reason for you to use only uppercase entity names (not longer, then 30 characters, by the way) is to avoid using quotes, when accessing them. I haven't ever heard of any performance impact though.

If you name something FUNC, you will be able to call it fUnC or Func (without quotes!) later.

But if you call it func with quotes, that will be the only name you may use.

like image 26
David Jashi Avatar answered Apr 06 '23 17:04

David Jashi