SQL is way faster than PHP processing. I would really go for a filtered join. That's what SQL is there for :) Just be sure to filter by index and to return a limited resultset.
Sequential scan in PHP has to be ABSOLUTELY avoided :) Marco Pivetta @Ocramius <http://twitter.com/Ocramius> http://marco-pivetta.com On 4 May 2011 12:19, passkey1...@gmail.com <passkey1...@gmail.com> wrote: > Hi there, > I'd like to ask you guys a question when you have to deal with a VERY > complex query. > Use case: > An e-commerce website with integrated social network. User could have many > friends on that website. For each user, I have to list all products which: > - are marked as featured (sponsored products, for instance). > - have already been purchased by at least one of his friends. > - he did not purchase yet. > .... > - are available in his country > .... > and so on. > > For these kinds of complex query, I would not imagine that a SQL query is > an appropriate solution. My thought was to make a simple query, then do some > processing in php to filter out all records that do not satisfy the > condition. > > How did you guys think of that solution? Have you ever dealt with such kind > of query? > > Thanks, > Tuan > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony users" group. > To post to this group, send email to symfony-users@googlegroups.com > To unsubscribe from this group, send email to > symfony-users+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en > -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en