On 01/31/2003 6:45 AM, "William Goedicke" <[EMAIL PROTECTED]> wrote:

> Dear Richard - 
> 
> Richard Morse <[EMAIL PROTECTED]> writes:
> 
>> Hi!  I'm writing a program to extract data from a database.  The program
>> runs rather slowly, and I'd like to speed it up.
> 
> Please post a relevant snippet of your code.  (Do you have 276036
> seperate SQL statements or are you mistakenly re-preparing
> statements?)

Hi!  Overnight, I did manage to get a tremendous speed up.  Originally, I
was doing this:

Foreach my $table ('table1', 'table2', 'table3', ...) {
    my $statement = "select col1 from $table where clause='$somevalue'";
    my $sth = $db->prepare($statement);
    ...
}

However, at around 2 this morning, I did this:

My $sth1 = $db->prepare("select col1 from table1 where clause=?");
My $sth2 = $db->prepare("select col1 from table2 where clause=?");
...

Foreach my $sth ($sth1, $sth2, ...) {
    $sth->execute($somevalue);
    ...
}

It really sped things up!  What's killing me now is running 268,000 SQL
instructions on an ADO linked AccessDB, to take the data that I had
extracted and put in into a new database (in a completely different
format...)


Sorry that I forgot to update the list -- I'm kinda out of it here, as I'm
not in the habit of staying up this long...

Hopefully I'm not blathering, and I'm writing somewhat intelligebly...

Ricky

_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to