Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

umairparacha's avatar

What to use for pagination having rows more then 15 million with Mysql

Hi everyone,

I have 15 million records in the results table, and we need to order by backlog_day descending, and its value will be the difference between the current date and evaluation_due_date. I tried to use cursor pagination, but cursor pagination requires a unique column for pagination, and the backlog_days can have the same values.

Pagination with offset is not performant enough for this large dataset. What should I use? Please suggest.

Thanks

0 likes
3 replies
Tray2's avatar

Do you have an index on the backlog_day?

Tray2's avatar

@umairparacha Consider using an virtual column, that way you can index it and the ordering will be way faster.

Please or to participate in this conversation.