MySQL Forums
Forum List  »  Performance

Re: Does prefixing field names with their table name improve query speed?
Posted by: Rick James
Date: February 21, 2016 07:19PM

I hope the rest of the test was not this ill-thought-out!

1. For compatibility reasons with other SQL servers. -- It is folly to even consider compatibility. And what about "[dbo]" that MySQL does not recognize? Or the necessary brackets around table names of some database vendors?

2. To optimize queries speed. -- In English, it should be possessive "the query's", not plural "queries". The speed of the execution of the query is totally unaffected. The speed of the parsing: the parser has to check the table name if you give it, or discover the table name if you don't. And parse speed is usually insignificant in the overall picture. (Apologies if you are translating to English.)

3. So that SQL doesn't confuse names. -- "SQL"? What is SQL? Maybe it should say "the user"? Or "the parser"?

Since you asked the question, it sounds like you will learn SQL _in spite of_ the person teaching you! I feel sorry for your classmates.

Do qualify all column names with the table name (or an alias) when more than one table is involved. The main reason for it is "clarity for the reader".

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Does prefixing field names with their table name improve query speed?
777
February 21, 2016 07:19PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.