Re: Adding a new counter cache
Wouldn't this run an infinte loop? It needs a further WHERE clause maybe where model_a.model_b_count IS NOT NULL marți, 16 martie 2010, 10:28:28 UTC+2, phpMagpie a scris: I would also run a SQl query direct on the database using phpMyAdmin or the CLI UPDATE model_a SET model_a.model_b_count = (SELECT COUNT(model_b.id) FROM model_b WHERE model_b.model_a_id = model_a.id) HTH Paul -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: hasOne load time x4
Indeed my friend! I didn't have a FK on B, after creating one I had the desired result ... 1,7s average. Thank you! luni, 4 noiembrie 2013, 10:23:07 UTC+2, Ashish Mahana a scris: HI Aurelian, There is not any problem when you use containable, its good to use that feature. Coming to the problem part, 1. First thing what i guess is that you have not set the index properly for tables that are related so that you are also delaying the result in the second association ($hasMany) 2. Second thing is that if u have *A $hasOne B* association then cake expects one-one relationship with respect to the primaryKey and foreignKey as it find violation of referential integrity it causes slow record fetching. if you have any doubt you are welcome to ask. On Friday, November 1, 2013 9:42:55 PM UTC+5:30, Aurelian Apostol wrote: I am using two tables items and products, item hasOne product. When making a containable pagination on Item it loads 1200 rows in 13s, when moving Product in hasMany it loads in 3,2s. With no other changes on the models or any other place as that matters. Any ideas? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
hasOne load time x4
I am using two tables items and products, item hasOne product. When making a containable pagination on Item it loads 1200 rows in 13s, when moving Product in hasMany it loads in 3,2s. With no other changes on the models or any other place as that matters. Any ideas? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.