$i=0; while(1) {    warn $i;    $sql = qq{SELECT accesslog_id FROM accesslog WHERE accessdate >= "2004-01-01 00:00:00" LIMIT $i,1000};    $sth = $g_dbh->prepare($sql);    $sth->execute;    $x = $sth->fetchall_arrayref;    last if not @$x;    $i+=1000; }'