I'm using two very large tables, one of which is ten times the size of the other. I have fields in both tables, as an example, in this order field_1, fields_2, field_3 etc. Let's name our two table large_TABLE and very_large_TABLE. My question involves the most efficient order in which I arrange my fields and how I join the two tables. The field "username" is the common field that both tables have.
"select* from large_TABLE, very_large_TABLE where very_large_TABLE.field_1='whatever' and very_large_TABLE.field_2='whatever' and very_large_TABLE.field_3 = 'whatever' and large_TABLE.username=very_large_TABLE.username";
My questions about this are-
1- Is it okay to change the order in which I have the fields in the select statement if I feel it is more efficient that way, or is it counter productive to go against the order in which they appear in the database.
2- The common field both tables have in the "join" is "username". I would think that it is more efficient to compare the smaller table first to the larger table to cut down time. (Better to go through 50,000 usernames on a smaller table than start with 500,000 usernames in a larger table) Would I keep the smaller table first in the order of the select statement?
I hope I was able to make this understood clearly. Thanks for any help or advice.