First: even if your accountid doesn't change it is better to use prepared statements.
my $sql = "SELECT o.objectid, <other fields> FROM object o WHERE o.accountid = ? ORDER BY o.objectname LIMIT 20 OFFSET 0"; .... my $sth=$dbh->prepare($sql); $sth->execute($accountid);
This will give you (maybe) a small speed increase in this example.
Second: fetchall_arrayref returns all data in one structure. This involves a lot of copying. Probably you should take a look at fetchrow_arrayref. This will get one row at a time (so you can process one row at a time).
In reply to Re: DBI execute is slow?
by peter
in thread DBI execute is slow?
by mlorenz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |