20k rows can be quite a lot of data, especially with many large columns. I've been dealing with performance issues with tens of thousands of rows in Informix, and it can be quite slow.
However, LOAD / UNLOAD is just about as slow as DBI. Those are the Informix commands to read from / dump to a file. COPY is a similar command in PostgreSQL. You didn't say which DB you're using. As others have said, you should start by running the equivalent query from your command-line database tool (dbaccess or psql or whatever) and time it. This is trivial to do, you just feed it the SQL statement. -Will -----Original Message----- From: Divya [mailto:[EMAIL PROTECTED] Sent: Thursday 12 May 2005 07:58 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 - - - - - - - Appended by Scientific-Atlanta, Inc. - - - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.
