Lets say I have a query
UPDATE foo.bar SET crop=5 WHERE soil=’brown’
I would write this as so:
UPDATE
foo.bar
SET
crop = 5
WHERE
soil = 'brown'
I write queries in this format to make them more readable in my code. However, this is being transfered between a web server and a DB server, so I assume that the wasted space will take up some bandwidth and have some slowdown in transfer.
Assuming I am writing much larger queries, ones that take 20+ lines, is this inefficient to the point of not being worth it?
You should always write your queries such that they are maximally readable. If you are really worried about saving bytes transferred to and from the server you can run your queries through a database connector and set the options such that extraneous whitespace is removed. This might already be happening with your current code. Have you actually snooped on the SQL data that is being sent across the network to see what it looks like?