There are many possible reasons. net_read_timeout and net_write_timeout were added in 3.23.20. The read timeout (presumption query is select) default value is 30 seconds and setting it in the my.cnf file requires a restart (of MySQL) to take effect. It seems you know all this. I also assume that you are on Win32 as you are referring to a .INI file?

Although you query works off the command line the CGI environment is different. Webservers will abort connections after a period of inactivity, usually in the range 30-60 seconds. It is possible that your command line login runs the query with a higher priority. Establishing the exact time that it takes to timeout may be useful in tracking down the issue. Printing epoch time stamps before/after the query or the total time in the err msg may well provide a useful hint. Not that it is relevant but on *nix tcp(1) has a connect timeout of 75 seconds exact values often indicate the source.

This is a very long time for any query. Are you using appropriate primary keys/unique/indexes? You may benefit from having a look at 'DESCRIBE table_name' and 'EXPLAIN query_goes_here' to see if you can speed it up. This of course will not really solve the underlying issue but is worthwihile regardless.

If you post the query you may get some useful optimisation suggestions.

cheers

tachyon


In reply to Re: DBD::MySQL timeout during query by tachyon
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.