Commit 97ef20de authored by Matthieu Muffato's avatar Matthieu Muffato
Browse files

It is more efficient to give MySQL a LIMIT clause

parent e2ac50d8
......@@ -103,14 +103,13 @@ sub _get_rowcount_bound {
my $inputquery = $self->param_substitute( $self->param('inputquery') );
warn "Testing at least '$maxrow' rows of the input query: '$inputquery'" if ($self->debug());
$inputquery .= " LIMIT $maxrow" unless $inputquery =~ /LIMIT/i;
my $sth = $self->data_dbc()->prepare($inputquery);
my $nrow = 0;
while ($nrow < $maxrow) {
my $row = $sth->fetchrow_arrayref();
last unless (defined $row);
while (defined $sth->fetchrow_arrayref()) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment