Again, what DBMS are you using.  You should also try your sql outside of
Perl.  The problem may lie with the DBMS.  For instance there are ways
to optimize your queries in Oracle using hints.  Also, unindexed columns
used in your where clause will cause a full table scan and worse.  The
Perl DBI is very efficient.  My experience is with Oracle and MySQL.
The DBDs for these DBs seems quite efficient to me.

-Ian

-----Original Message-----
From: Divya [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 12, 2005 5:58 AM
To: [email protected]
Subject: Perl Performance Help.

 

Hi All,

 

I am in a Perl based project, where we fire a query which returns 20K
records.

In the perl side, we use the following snippet to get the query result
to an
array.

 

while (  @each_record = $stmt_handle->fetchrow)

  {

push @records, [ @each_record ] ;

}

 

Upon analysis, we found that "$stmt_handle->fetchrow"  is the one taking
around 2 minutes. 

 

Below are the options we tried:

1.      Used FOR loop instead of while loop: since while loop
manipulates
the boundary condition at every looping. 
2.      instead of fetch row we also tried
$stmt_handle->fetchall_arrayref()
, $stmt_handle->fetchrow_array() and $stmt_handle->fetchall_hashref().
Even
didn't seem to help much. 

 

Has anybody come across, similar scenario. Is there any other way that
will
take less time to fetch the data and assign to an array. 

It would be helpful if you could come up with some alternate
suggestions.

Please mail to my ID .

 

Thanks and Regards,

Divya

 

Reply via email to