Thanks. Yes, the query is a select:
SELECT COUNT(DISTINCT seq) FROM Peptide;
Peptide contains almost 2 millions rows (not that big a deal)
EXPLAIN AND DESCRIBE: mysql> explain select count(distinct seq) from Peptide; +---------+------+---------------+------+---------+------+---------+-- +-----+ | table | type | possible_keys | key | key_len | ref | rows | E +xtra | +---------+------+---------------+------+---------+------+---------+-- +-----+ | Peptide | ALL | NULL | NULL | NULL | NULL | 1860342 | + | +---------+------+---------------+------+---------+------+---------+-- +-----+ 1 row in set (0.02 sec) mysql> desc Peptide; +--------+---------------------------+------+-----+------------+------ +----------+ | Field | Type | Null | Key | Default | Extra + | +--------+---------------------------+------+-----+------------+------ +----------+ | pepid | int(10) unsigned zerofill | | PRI | NULL | auto_ +increment | | proid | int(10) unsigned zerofill | | MUL | 0000000000 | + | | seq | tinytext | | MUL | | + | | mh | double | | | 0 | + | | expect | double | | | 0 | + | | start | int(11) | | | 0 | + | | end | int(11) | | | 0 | + | | charge | tinyint(1) unsigned | YES | | NULL | + | | delta | float | | | 0 | + | | dida | int(11) | | | 0 | + | | didb | int(11) | | | 0 | + | | didc | int(11) | | | 0 | + | +--------+---------------------------+------+-----+------------+------ +----------+ 12 rows in set (0.00 sec)
The index on seq is index iseq (seq(20)) The average length of seq is 16 and the max is 113. The number with length over 50 is 2400 or so. I set the net_read/write_timeout to 60 and restarted server, but no difference. Also I am using .ini with the settings from my-huge.cnf.
When I say that it times out from the perl script, I am only running it from the command line:
C:\testing\scripts>perl stat_tester.pl Connected DBD::mysql::db do failed: Lost connection to MySQL server during query + at stat_tester.pl line 54.

so I don't think that it could be a web server problem. This message comes after about 30 seconds.
All this leads me to believe that its an issue with DBD or DBI. Quite possibly the error message is misleading?

I will try upping the index length on the seq field, but still, I don't think it's unreasonable to have a query that takes longer than 30 seconds at some point in the life of ones database.
Thanks for the help so far!

In reply to Re^2: DBD::MySQL timeout during query by rcraig
in thread DBD::MySQL timeout during query by rcraig

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.