You are here: Lots of small queries vs one big query « PHP Programming Language « IT news, forums, messages
Lots of small queries vs one big query

Posted by listerofsmeg01 on 11/22/06 00:09

Hi,

Pretty new to PHP and MySQL.

I have a page on my site that displays a lot of information from
various tables. Currently I have lots of small PHP wrapper functions
around SQL queries to get each bit of information. This results in
maybe 10 queries to display one page, but they are all very small and
simple, and it keeps the PHP looking nice too as they are simple
function calls to get each piece of info, which can be called from any
page in my site.

However, after reading up on SQL a bit, I am wondering whether I should
be looking at just generating one large query at the start, and using
joins etc to lump all the relevant info together. This complicates the
PHP as this means a custom query for each page of my site depending on
what needs to be displayed, but I am wondering if it is worth it if I
get a fair performance gain.

Can any gurus point me in the right direction? Is there a "proper" way
to do this sort of thing?

Many thanks.

 

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

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