in reply to Much slower DBI on RHEL6
Try running the query with the mysql commandline client to see whether you get a significant runtime difference. That way you could isolate the problem to mysql if possible.
In any case I don't see how the code could possibly work the way the comments indicate was intended. If 'id' is indeed a record ID as is customary in relational DBs, the DISTINCT does nothing. If not, it's indeed useful but then the results will be read one id at a time and nothing like "the hash will only keep one key but it will be the oldest one" happens. Then the same id is read again together with a single description. It looks like a
would do the same job. Or the whole script asSELECT DISTINCT id,description from list_index
my $sql = 'SELECT DISTINCT id,description FROM list_index'; foreach(@{ $dbh->selectall_arrayref($sql, {Slice => {}}) }) { $labels{$_->{id}} = "$_->{id} - $_->{description}"; }
If that doesn't help, try and check the DDL, i.e. the CREATE TABLE, especially the indices on both tables.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Much slower DBI on RHEL6
by MPM (Novice) on Feb 05, 2014 at 23:04 UTC | |
Re^2: Much slower DBI on RHEL6
by karlgoethebier (Abbot) on Feb 05, 2014 at 23:55 UTC | |
by MPM (Novice) on Feb 06, 2014 at 02:38 UTC |