Just shooting from the hip, I would say the faster method would be to create
the 5 different mysql queries.  The amount of time taken up by retrieving
500 articles of either blob or text can add up to a significant amount of
time, whereas 5 queries that average 10 results per query would result in
~90% decrease in reading data from the database.  Performing aggregate mysql
functions for most commented and etc are generally very fast and can be done
much more quickly than retrieving the whole article, passing to php, storing
to memory and then manipulating the data.

Thanks

patrick



2009/8/4 Martin Zvarík <mzva...@gmail.com>

> I need to do about 5 queries:
>
> 1) pick the top visited articles
> 2) pick the recent articles (limit 10)
> 3) pick the most commented articles
> etc.
>
> Now, I have 2 choices:
>
> 1) SELECT ALL records and use PHP for conditions
>
> 2) do 5 queries on MySQL
>
>
> ---
>
> Imagine it has 500 long text articles.
>
>
> Which of these 2 options is better for performance?
>
>
> Thanks,
>
> Martin
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to