Re: Sub selects vs nested loop

From: Date: Tue, 09 Nov 2004 10:07:35 +0000
Subject: Re: Sub selects vs nested loop
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-201602@lists.php.net to get a copy of this message
Hi guys and girls, while we are on this topic, has anyone got a good senario of a sub select query which can remove the nested loops ? I have been wanting to get rid of nested loops for a good while and now Mysql 4.1 is out I would like to start using it. So the usual scenario for nested loops to to get data out of a 1 to many relationship. Please put me on the right path, I had asked the Mysql list but no success. Daniel On 09/11/2004, at 5:45 AM, Greg Donald wrote:
On Mon, 08 Nov 2004 21:57:41 +0600, raditha dissanayake <jabber@raditha.com> wrote:
Sorry no benchmarks, i am talking from personal experience where I converted some code from a php nested loop to mysql. I was rather surprised by the results. I will concede that I may not have optimized the query properly or that I may not have had the correct indexes, but since I have been doing this for quite a few years i like to think i got the query right. (feel free to deflate my ego :-) )
Well yeah.. It's hard to believe a well written MySQL sub select query with proper indexing would be slower than looping through the results with PHP scripting. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#201602) next »