mysql - Pagination with lot of records avoid limit offset -
for example, has big mysql table (10kk records).
table struct:
create table `contents` ( `id` int(10) unsigned not null auto_increment, /* fields hidden */ `update_time` int(10) unsigned not null default '0', /* index */ primary key (`id`) ) engine=innodb default charset=utf8;
update_time
may changed current unix timestamp time.
select query:
select ... contents ... order update_time desc [limit ...];
how make pagination, avoid limit offset? limit offset not useful query, because it's reading unneeded rows. example, select ... contents limit 9000000, 100
read ~9000100 rows.
Comments
Post a Comment