Hi,
Using secondary indexes will be a good standard way. If that doesn't work, then in select also you have to move out from conventional way, that is:
first take a counter for maximum records..
selection can be made in a do n times loop (say max records/100 times)
select upto say 2000 records in a shot -> mark the lat key to some temporary file/table
then from the last key another 2000 records... like that.. this could be tricky and ofcourse not the best way.. but try in the worst case.
Regards,
Renjith