Hello David, the solution you came up with is rally BAD!!! people burn in hell for code like that. seriously
look at what you are doing 1. you select all records from your linking table (which is double the size of your posts table. assuming every post has 1-4 tags on average) in one query. insane right? 2. then you go through entire record set extracting post ids (lot's of duplicates because every post has 2-4 tags on average) 3. you do full index scan on your posts table (2-4 time for every post, because you didn't do distinct select in previous insane steps) excluding virtually every record except few latest uncategorized posts. in the long run those 3 lines of code will crush your server. perhaps you should look into habtm countercache. although it is not implemented for habtm as core feature. i've come across some articles with workarounds do that and it will come down to one indexed select on countercache field where countercache is zero Cheers On Fri, Apr 29, 2011 at 5:53 AM, davidhc <davi...@gmail.com> wrote: > Ignore my previous message... > > I have solved it with this http://bin.cakephp.org/view/471586323 > > Thank you again, cricket :D > David. > > On 29 abr, 10:17, davidhc <davi...@gmail.com> wrote: >> Only one more doubt... >> >> Could I use the native cakephp paginator with this model function? > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php