Reputation: 906
I'm using Bootstrap tables to show records in table format coming from Mysql Database.
As Records are more than 6000, It takes a long time to load all the data. It makes my application very slow. Can we load data when we click on page numbers? So initially it supposed to take only 20 records than one-page number click it supposed to take next 20 records. Something like that?
Upvotes: 2
Views: 6208
Reputation: 142296
Pagination via OFFSET
has performance problems. Instead, "remember where you left off". See http://mysql.rjweb.org/doc.php/pagination for discussion of the technique.
Upvotes: 0
Reputation: 559
There are two possible solutions:
Upvotes: 1
Reputation: 55
Client side pagination will have the same impact since the data is loaded during the page load. If initial loading time is your concern, then server side pagination data-side-pagination="server"
is what you want, because (obviously) it reduces the effort of the server as it divides the requests by chunks depending on the page limit. It's documented in their site here
<table id="table"
data-toggle="table"
data-url="/examples/bootstrap_table/data"
data-height="400"
data-side-pagination="server"
data-pagination="true"
data-page-list="[5, 10, 20, 50, 100, 200]"
data-search="true">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th data-field="id">ID</th>
<th data-field="name">Item Name</th>
<th data-field="price">Item Price</th>
</tr>
</thead></table>
Upvotes: 2
Reputation: 33186
Yes, when you have a lot of records, it is better to show only chunks of it at a time. This will greatly reduce the amount of time it takes for a page to load.
You can select chunks by using LIMIT {start}, {amount}
in your MySql queries.
Upvotes: 1