in reply to Counting all records but selecting only a few
Please show your Perl code.
SELECT * from $log_table order by 'sticky desc', dateadded2
will result in all records from log_table, sorted by an order.
If log_table is only 100,000 entries, this is very fast.
Probably so fast that you can't blink that fast.