I need help with a select
query.
I have a table with millions of records, and I have used:
select * from table where status=1 limit $start,$pagesize
for paging so it loads 25 records per page.
My concern is that when I run the query with thousand of records in the table, the load time is acceptable, but as soon as I run the query with bulk records, the load time increase.
So I tried to find a way, and now I want to show only 2500 latest records from table with limit 0 to 25 .
select * from (select * from table
where status=1 order by id limit 0,2500)t
where status=1 order by id limit $start,$pagesize
but the load time isn't affected.
Can anyone suggest a better way please?
I'm using indexing already and have indexes on table for the status and id fields.