Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Much slower DBI on RHEL6

by mbethke (Hermit)
on Feb 05, 2014 at 22:38 UTC ( [id://1073621]=note: print w/replies, xml ) Need Help??


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

SELECT DISTINCT id,description from list_index
would do the same job. Or the whole script as
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

    perhaps some sample data would make things clearer

    +---------+--------------------------------+--------------------+ | id | description | rpt_key | +---------+--------------------------------+--------------------+ | ABC | Organizational Detail Newer | ABC.2013_10_18 | | ABC | Organizational Detail Older | ABC.2012_10_15 | | XYZ | XYZ Status | XYZ.2012_08_05 | | XYZ | XYZ Status | XYZ.2012_08_12 | | XYZ | XYZ Status | XYZ.2013_08_14 | +---------+--------------------------------+--------------------+

    So the values I would want are:

    ABC - Organizational Detail Newer XYZ - XYZ Status
Re^2: Much slower DBI on RHEL6
by karlgoethebier (Abbot) on Feb 05, 2014 at 23:55 UTC

    Mmh, may be. But how this cohere with the RHEL 5 vs RHEL 6 issue?

    Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

      sorry, not sure what you are asking here. I put sample db data and target result in response to show that the suggested query by mbethke wouldn't get the needed results... I think I was unclear on what the code should be doing

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1073621]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-16 10:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found