Sounds like you need to look at AJAX. The reason being is you can make a progress bar to explain to the user it is executing the search

However, I would be more inclined to look at your select statement and figure out why it takes 20 seconds to return. One of the EASIEST ways to cut down the return time on an SQL statement is using Limit. With my suggested AJAX usage (CGI::AJAX), you can then make additional calls to the database in the background to load up the rest of the data while the user looks at the smaller result set.

If you can prevent it, there is really NO reason to send a user 550 results when he really just cares about the top five lines.

Oh, and did I mention, no one likes reading through huge datasets.

To kill the select statement, you need to know the thread_id in mysql, and have the proper permissions to issue a kill command. You can then send a command through MYSQL to kill the select. Most times this requires PROCESS privileges that most shared db owners will not give you. If it's dedicated do what you want, it's your data to kill.

As of MySQL 5, you can use the KILL QUERY command to kill the current query that is running for your active connection. Kill first showed up in MySQL 4.1, and something similar is in 3.23 under "zapp" but I wouldn't touch that one...
--

Even smart people are dumb in most things...

In reply to Re: Cancel DBI Mysql request in a CGI script called with XMLHTTPREQUEST by Devanchya
in thread Cancel DBI Mysql request in a CGI script called with XMLHTTPREQUEST by joe_kool

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.