This is a discussion on how to optimize the dbase within the MySQL forums, part of the Database Server Software category; --> Hi on my website home page there's an heavy and repetitive number of query that slow down the speed ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi on my website home page there's an heavy and repetitive number of query that slow down the speed of the page opening. Could you suggest me some link or 'how to' to optimize the queries or to improve the page loading time? Regards. Mark - Italy |
| |||
| On Thu, 09 Aug 2007 19:56:00 +0200, Mark wrote: > Hi > on my website home page there's an heavy and repetitive number of query > that slow down the speed of the page opening. > Could you suggest me some link or 'how to' to optimize the queries or to > improve the page loading time? More RAM, better indexing, prebuilding "dynamic" pages that are actually semi-static. That's roughly in order of simplicity, though the last is actually fiendishly powerful done right. -- 6. I will not gloat over my enemies' predicament before killing them. --Peter Anspach's list of things to do as an Evil Overlord |
| |||
| > Peter H. Coffin ha scritto: >> On Thu, 09 Aug 2007 19:56:00 +0200, Mark wrote: >>> Hi >>> on my website home page there's an heavy and repetitive number of query >>> that slow down the speed of the page opening. >>> Could you suggest me some link or 'how to' to optimize the queries or to >>> improve the page loading time? >> >> More RAM, better indexing, prebuilding "dynamic" pages that are actually >> semi-static. That's roughly in order of simplicity, though the last is >> actually fiendishly powerful done right. >> > For example whith these queries: $qtot="SELECT COUNT(id) FROM news WHERE argomento='alfa' AND mostra='si'"; $qtotb=mysql_query($qtot) or die('errore'.mysql_error()); $indc=mysql_fetch_array($qtotb); mysql_free_result($qtotb); $qtot="SELECT COUNT(id) FROM news WHERE argomento='beta' AND mostra='si'"; $qtotb=mysql_query($qtot) or die('errore'); $indd=mysql_fetch_array($qtotb); mysql_free_result($qtotb); $qtot="SELECT COUNT(id) FROM news WHERE argomento='gamma' AND mostra='si'"; $qtotb=mysql_query($qtot) or die('errore'); $inde=mysql_fetch_array($qtotb); mysql_free_result($qtotb); $qtot="SELECT COUNT(id) FROM news WHERE argomento='delta' AND mostra='si'"; $qtotb=mysql_query($qtot) or die('errore'); $indf=mysql_fetch_array($qtotb); mysql_free_result($qtotb); $qtot="SELECT COUNT(id) FROM news WHERE argomento='eta' AND mostra='si'"; $qtotb=mysql_query($qtot) or die('errore'); $indg=mysql_fetch_array($qtotb); mysql_free_result($qtotb); $qtot="SELECT COUNT(id) FROM news WHERE argomento='teta' AND mostra='si'"; $qtotb=mysql_query($qtot) or die('errore'); $indh=mysql_fetch_array($qtotb); mysql_free_result($qtotb); is there a way to optimize or unite them in a single faster query? I'm a beginner with MySQL so please have patience. Regards Mark |
| ||||
| "Mark" <mccartney@emiggeas.it> schreef in bericht news:46bb611e$0$37205$4fafbaef@reader3.news.tin.it ... >> Peter H. Coffin ha scritto: >>> On Thu, 09 Aug 2007 19:56:00 +0200, Mark wrote: >>>> Hi >>>> on my website home page there's an heavy and repetitive number of query >>>> that slow down the speed of the page opening. >>>> Could you suggest me some link or 'how to' to optimize the queries or >>>> to improve the page loading time? >>> >>> More RAM, better indexing, prebuilding "dynamic" pages that are actually >>> semi-static. That's roughly in order of simplicity, though the last is >>> actually fiendishly powerful done right. >>> >> > > For example whith these queries: > > $qtot="SELECT COUNT(id) FROM news WHERE argomento='alfa' AND mostra='si'"; > $qtotb=mysql_query($qtot) or die('errore'.mysql_error()); > $indc=mysql_fetch_array($qtotb); > mysql_free_result($qtotb); > > $qtot="SELECT COUNT(id) FROM news WHERE argomento='beta' AND mostra='si'"; > $qtotb=mysql_query($qtot) or die('errore'); > $indd=mysql_fetch_array($qtotb); > mysql_free_result($qtotb); > > $qtot="SELECT COUNT(id) FROM news WHERE argomento='gamma' AND > mostra='si'"; > $qtotb=mysql_query($qtot) or die('errore'); > $inde=mysql_fetch_array($qtotb); > mysql_free_result($qtotb); > > $qtot="SELECT COUNT(id) FROM news WHERE argomento='delta' AND > mostra='si'"; > $qtotb=mysql_query($qtot) or die('errore'); > $indf=mysql_fetch_array($qtotb); > mysql_free_result($qtotb); > > $qtot="SELECT COUNT(id) FROM news WHERE argomento='eta' AND mostra='si'"; > $qtotb=mysql_query($qtot) or die('errore'); > $indg=mysql_fetch_array($qtotb); > mysql_free_result($qtotb); > > $qtot="SELECT COUNT(id) FROM news WHERE argomento='teta' AND mostra='si'"; > $qtotb=mysql_query($qtot) or die('errore'); > $indh=mysql_fetch_array($qtotb); > mysql_free_result($qtotb); > > is there a way to optimize or unite them in a single faster query? > I'm a beginner with MySQL so please have patience. > > Regards > > Mark you could add an INDEX on 'argomento' and/or on 'mostra'..... |