Greetings

Please forgive what is probably a newbie breach of netiquette, but I
have hit a wall.

I am trying to access a mysql database using DBI:mysql with perl 5.8. My
query:
    etc etc

    my $rth = $dbh->prepare("SELECT * FROM demographics_1 WHERE
KEY1=$key");
    $rth->execute();
    my @records;
    while (my $ref2 = $rth->fetchrow_hashref()) {        
        if ( defined $ref2 ) {
            my $address = $ref2->{'PRIMARY_NO'}."
           ".$ref2->{'PRE_DIRECTIONAL'}." ".$ref2->{'STREET'}."
           ".$ref2->{'STREET_SUFFIX'}." ".$ref2->{'POST_DIRECTIONAL'};
            my $name =
        $ref2->{'FIRST_NAME'}.$ref2->{'MI'}.$ref2->{'LAST_NAME'};

       more processing...

This takes forever:

DBI::Profile: 93.279098 seconds (22 method calls) matchDemographics.pl
'DBD::_::st::fetchrow_hashref' =>
    0.000223s
'DBD::mysql::db::DESTROY' =>
    0.000018s
'DBD::mysql::db::disconnect' =>
    0.000098s
'DBD::mysql::db::prepare' =>
    0.000303s
'DBD::mysql::st::DESTROY' =>
    0.000031s
'DBD::mysql::st::execute' =>
    93.277343s
'DBD::mysql::st::fetchrow_hashref' =>
    0.001074s / 15 = 0.000072s avg (first 0.000082s, min 0.000048s, max
0.000113s)
'DBD::mysql::st::finish' =>
    0.000008s

The same query from the command line takes 0.02 seconds. A factor of
5,000 tells me I've made a stupid blunder somewhere, but I've read and
reread the documentation and it all looks OK to me.

Is there a FAQ somewhere, or does someone have an idea of common blunders that
lead to huge performance degradations?

Thanks.

Mike Muratet

Reply via email to