If you do not restrict the # of rows returned, you could easily crash older machines.
I did build a general CGI interface to databases, with database/table/column displays, query saving, etc... (which you're welcome to), and found out that some of my users were complaining that their machines were crashing.
It turns out that upon investigation, it is not a good thing to let Internet Explorer retrieve a 100,000-row table to display on an under-1GHz machine. :-)
The obvious solution is that before every SQL call you call "SET ROWCOUNT $MAXROWCOUNT" (under Sybase) where I suggest $MAXROWCOUNT < 20000.
H.
On Apr 5, 2004, at 11:11 AM, Chris Mungall wrote:
I would like to provide power-users with a CGI interface to a database;
this interface would allow arbitrary SQL. I would also like to be able to
throttle queries that take too long to stop the db server getting backed
up with killer queries.
Right now I am doing this:
my $tag = "kill$$"."TAG"; my $tagf = "/tmp/$tag"; system("touch $tagf && chmod 777 $tagf && sleep 15 && test -f $tagf && kill -9 $$ && rm $tagf &");
# execute query $results = $dbh->do(...)
# inactivate killer system("rm $tagf &");
# print results....
However, this isn't much good as it just kills the CGI process, the killer
query carries on running on the db server.
I have thought about extending my hacky shell kill pipe to also run mysqladmin -kill and whatever the postgresql equivalent is, but then thought:
- way too messy and hacky - someone must have solved this one already
However, I couldn't find any module for dealing with this. Any suggestions?
Cheers Chris
