You are here: Re: Caching query results: PHP caching vs MySQL caching « PHP Programming Language « IT news, forums, messages
Re: Caching query results: PHP caching vs MySQL caching

Posted by Moot on 12/12/06 19:43

Hermann wrote:
> My site is a bit slow showing the main page so I thought caching query
> result in PHP will improve performace.
> Then I read MySQL documentation and saw that MySQL does have a caching
> feature.
> So... now I dont know if doing the PHP caching is worth the pain.
> Would there be any noticed performace improvement if I cache query
> results in PHP, considering that MySQL is already caching the queries?
>
> Thanks

MySQL's caching is a start, but only if the queries are your actual
problem.

Do some profiling to see what portions of the code are causing the
slowdown (can be as simple as echoing out microtime() after each
significant logic block).

If the query turns out to be the problem, then verify that your table
schema has any appropriate indexes and check your query to make sure it
is optimized. Only after you've done this should you worry about
caching.

Finally, if the page does not need to be dynamic (ie: something new
every load), then consider caching the entire page as a static version
of itself for a period of time using Smarty or something similar.

- Moot

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация