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

user_hkcl's avatar

Datatable Server side processing

Can someone provide complete code of server side processing of datatable.

Actually I have to display millions of record using datatable which takes so much time.

0 likes
5 replies
jlrdw's avatar

They have examples on their site. And yeah good luck with displaying millions of Records.

whitea2's avatar
whitea2
Best Answer
Level 2

You're displaying millions of records at once or your database contains millions of records and you'll display a subset (page) at a time?

The wonderful thing about DataTables server side processing is that you don't have to display all of the records at once. Similarly, Laravel also supports collection pagination (https://laravel.com/docs/5.6/pagination).

Example from DataTables: https://datatables.net/examples/data_sources/server_side

Good tutorial for Laravel: https://shareurcodes.com/blog/laravel%20datatables%20server%20side%20processing

jlrdw's avatar

I have to display millions of record using datatable which takes so much time.

Even with pagination, 20 per page. And figure to quickly view what's on a page - 2 to 4 seconds, just to paginate through a million records =

Almost four days.

You said millions, so lets say five million, then it would take:

Over 19 days just to paginate the results.

20,000,000

77 days

A billion

over a year and a half.

That is 20 records per page. One per page would take 32 years.

So you better write a query to narrow the results.

1 like
newbie360's avatar

after go to that page, ok start loading......, all i care is after me dead, no one come to click the browser stop button on my computer. so sad, can't see the page content when i still alive

SdeWijs's avatar

I use this SSP class which is an extension of the serverside datatables class. https://github.com/emran/ssp .

It supports joins and an extra where clause. When using multiple joins on large tables, be sure to create indexes to speed up the query.

Please or to participate in this conversation.