2011/5/5 Matt Robinson <m...@lazycat.org>:
> On 4 May 2011, at 23:57, Michał Piotrowski wrote:
>
>> 2011/5/4 Marco Pivetta <ocram...@gmail.com>:
>>> 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 :)
>>
>> I'm not sure how to do this if I need a multiple dynamically added 
>> conditions.
>
> SQL (certainly in mySQL) supports conditionals in queries, so if the data you 
> use to make the choice is in the database, you can do it all in the query.
>
> Another way to approach your problem is to have your web app trigger events 
> when certain actions occur - this way you're approaching issues like "have 
> already been purchased by at least one of his friends" from the other end. 
> When someone buys a product, add it to each friend's recommendation list. 
> Then your look-up query is much more simple. You can even queue these events 
> up and process them later, since it's usually not vital that such information 
> is "live".
>
> As an aside: typically very complex queries like this are done by background 
> processes only periodically (e.g. every few hours) and stored in look-up 
> tables or similar. Particularly as you start getting many users, complex 
> queries quickly become a bottleneck, so you produce them offline beforehand 
> and store them in a way that's simple and quick to fetch by your site's PHP 
> scripts (in a simple cache table or object store). You never want a simple 
> request page to be doing so much heavy lifting that it'll slow down and 
> prevent you scaling later. If the heavy processing stuff is split off into a 
> separate process, you can also move that process to another server later.

Thanks for your know-how!

>
>
> -- Matt
>
> --
> 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
>



-- 
Best regards,
Michal

http://eventhorizon.pl/

-- 
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

Reply via email to