Here is a pastie of my current code. In the formatting on pastie, it’s
not listed entirely right.
The Select, Joins, Conditions, and Order statements are on separate
lines.
The issue I’m having is I’m finding all types of variations of query
times when I use this query. If I add them all to one solid line, at
times the query times go down and are much faster. If I separate them
in my IDE for readability, they are sent a little bit differently to
mysql and at times the query times go much higher.
With the same exact query I can sometimes reach 0.587ms or I can go up
to 0.24357ms, the latter being a crazy number.
So, I have been taught that the larger the query the better. This query
isn’t even finished yet.
My situation is that I have 37 statistical tables. Each of these tables
has roughly 14 columns each. So, all I’m doing is joining “one” column
from each table. In the overall scheme of things, it will look like:
4 columns from teams table +
37 single columns from 37 table joins +
2 full table joins of (14 columns each).
Yes, that’s a big query. I most likely will have to tailor it down some
but I shouldn’t be getting this large of a query return on this small of
a query that I have built right now. It’s roughly 25 columns right now
and mysql when I process it directly shows a return of 0.235ms.
So, what can I do to fix this issue and is there something wrong with my
code that might be making the statement too long or too chopped up?
And, why does code formatting with line separations increase the time?
Many thanks in advance…