Re: Too many SQL queries!!

2010-07-15 Thread keymaster
See this thread for a direct solution to your problem (use a finder query): http://groups.google.com/group/cake-php/msg/c10840be78a34df0 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are sub

Re: Too many SQL queries!!

2010-07-14 Thread eugenioc...@hotmail.com
Have you try caching the queries? Just add var $cacheQueries=true; in your app_model.php Cache query will not make a query twice example; $this->set('name',$this->Model->field('name',array('id'=>$id))); //more code if($this->Model->field('name',array('id'=>$id))=='something'){ //doSomethin

Re: Too many SQL queries!!

2010-07-13 Thread Alex Bovey
On Tue, Jul 13, 2010 at 12:24 PM, Mike Karthauser wrote: > refining by writing custom queries can be useful but having found an issue > recently where repeated custom queries were stealing memory and not being > cleared by garbage collection, i'd be a bit wary of this as a solution. > > if you do

Re: Too many SQL queries!!

2010-07-13 Thread Mike Karthauser
hi alex On Tue, July 13, 2010 11:57 am, Alex Bovey wrote: > Well, my debug level is 0 for production but since I can't see the SQL log > I'm turning it to 2 for debugging. > > Can I get cake to log the SQL somewhere and still set debug to 0? > > Interestingly I found this, which seems to imply tha

Re: Too many SQL queries!!

2010-07-13 Thread Alex Bovey
Well, my debug level is 0 for production but since I can't see the SQL log I'm turning it to 2 for debugging. Can I get cake to log the SQL somewhere and still set debug to 0? Interestingly I found this, which seems to imply that Containable is the cause of the problem, rather than the solution:

Re: Too many SQL queries!!

2010-07-13 Thread Jeremy Burns | Class Outfit
Out of interest, what is your debug level? Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 13 Jul 2010, at 10:57, Alex Bovey wrote: > Hi Nick, > > Thanks for the reply. > > Sorry I should have said in my original post - I'm already using Containable > AND

Re: Too many SQL queries!!

2010-07-13 Thread Alex Bovey
Hi Nick, Thanks for the reply. Sorry I should have said in my original post - I'm already using Containable AND setting recursive to -1 in app_model.php. But still the selects are incredibly inefficient - a single query to fetch each individual row?! I'm not specifying 'fields' but surely that'

Re: Too many SQL queries!!

2010-07-13 Thread nurvzy
Use a mixture of: fields option key (so you're not retrieving data you don't intend to use), containable (so you're not selecting associative models and their fields you don't care about), and set recursive = -1 in your app_model.php The first thing I do whenever I start any new CakePHP project i

Too many SQL queries!!

2010-07-13 Thread Alex Bovey
Hi all, Using Cake 1.2.0.6311 I'm having real problems with the number of SQL queries in my app. For example, I have Enquiry belongsTo User and User hasMany Enquiry. A simple $this->Enquiry->find('all') results in one query to fetch the enquiries, and then a separate query for every single Enqui