MySQL Forums
Forum List  »  Newbie

Re: avoiding Long SQL statements
Posted by: Roland Bouman
Date: August 01, 2005 08:40AM

As for processing multiple queries: think about it, each time a single query needs processing, it's sent to the server, the results are sent back where you process them yourself in your application layer. That's multiple times of overhead for parsing the queries, running the optimizer to create a queryplan, and generating network traffic. It's much more efficient to run just one single query, and its quite common to spend some time on crafting that query. And, congratulations, instead of maintaining some 5 line queries, you are maintaining 10s at the very least, but more probably hundreds of lines of php code that do the post query processing.

I just want to add, that if you are in a situation where you'd have multiple php pages that use the same, complicated join query or queries again and again, you can put that in a VIEW if you are running mysql >= 5. That does not prevent you from maintaining it, but it does ensure that there's a single point of definition, thats stored in a place where it belongs, e.g. the database.

Options: ReplyQuote


Subject
Written By
Posted
Re: avoiding Long SQL statements
August 01, 2005 08:40AM


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.