one might also want to change:

count(*)

to

count(1)

I presume this is valid in mysql.

        cheers, G.


On Tue, 1 Oct 2002 [EMAIL PROTECTED] wrote:

>
>       this is more-like db related question, but nevertheless you should check the 
>documentation for the DBI package. I think you can gain performance if you prepare 
>your query once and then only execute it. the sql parser is not something working 
>with a null-time response and the summ
>
> -----Original Message-----
> From: Davide Copelli [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 01, 2002 11:14 AM
> To: [EMAIL PROTECTED]
> Subject: Mysql performace 30000 record
>
>
> I need to execute multiply query on a Mysql database with 30000 record
>
> I use this code to read a txt file with 50 records (eg. page1 , page 2, page 3 etc) 
>and then execute some query (the code is ok):
>
> ......
> ......
>
> open (INPUT, "< $filepageid") || &file_open_error("$filepageid");
>
> while ($riga=<INPUT>){
> $nump++;
> chop($riga);
> $pagina[$nump] = $riga;
>
> $sth= $dbh->prepiare("SELECT count(*) FROM lognew WHERE
pageid='$pagina[$nump]' and data>='$startdate'"); $sth->execute; $totalvisit[$nump] = 
$sth->fetchrow_array();
>
> $sth = $dbh->prepare("SELECT count(*) FROM lognew WHERE (pageid='$pagina[$nump]' and 
>data='$dataoggi')"); $sth->execute; $totalvisittoday[$nump] = $sth->fetchrow_array();
>
>  $sth = $dbh->prepare("SELECT count(*) FROM lognew WHERE (pageid='$pagina[$nump]' 
>and data='$dataieri')"); $sth->execute; $totalyvisit[$nump] = $sth->fetchrow_array();
>
>  $sth= $dbh->prepare("SELECT count(*) FROM lognew WHERE (pageid='$pagina[$nump]' and 
>data<='$fine30gg' and data>='$inizio30gg')"); $sth->execute; $totalmvisit[$nump] = 
>$sth->fetchrow_array();
>
>  }
>
> close (INPUT);
>
> The question is:
>
> Using the same statement object $sth can affect MySql performance ? Are there 
>altenative ways to optimize this routine ? Are 30000 records to much for this kind of 
>query ?
>
> Thank you very much !
>
>
>
>
>

Reply via email to