HOW TO MAKE DATATABLES LOAD FASTER DEALING LARGE DATASETS (1million row)
HOW TO MAKE DATATABLES LOAD FASTER DEALING LARGE DATASETS (1million row)
Hello,
im currently working a project dealing large set of data around 1 million using datatables, im using PHP mysql for query and oracle 12c database. every time i run the program. data loads very slow. when i limit the data row to 50k only the load lessen. what i want is to load all the data faster and be paginated. but when the row go up 100k it load like hell. sorry for bad English..
for reference:
this is my table:
<table id="myTable" class="display table table-bordered">
<thead>
<tr>
<th>Account No</th>
<th>Consumer Name</th>
<th>ADDRESS</th>
<th>Amount</th>
</tr>
</thead>
<tbody id="data" >
<?php include("fetch2.php"); ?>
</tbody>
</table>
fetch2.php:
<?php
$statement = oci_parse($conn, "SELECT * FROM ethanhost.FDISCO ORDER BY CNAME ASC OFFSET 0 ROWS FETCH NEXT 500000 ROWS ONLY"); //<= this where i limit the rows
oci_set_prefetch($statement, 50);
oci_execute($statement);
while($row = oci_fetch_array($statement)) {
echo "<tr>";
echo "".$row['ACNT_CODE']."";
echo "".$row['CNAME']."";
echo "".$row['CADDRESS']."";
echo "".$row['AMOUNT']."";
echo "";
}
oci_free_statement($statement);
?>
and my script for datatable:
$(document).ready( function () {
$('#myTable').DataTable({
});
} );
this code is perfectly fine with 50k rows below. but when i tried to load all the rows on our database it crash my browser and loads freaking bad and slow.
hope you can HELP me. THANKS!
Answers
hello @ethandy211 you can go for server side scripting in order to load large amount of data
You can see the example here:
https://datatables.net/examples/data_sources/server_side
See this FAQ.
Allan
your ssp.class.php does not work for oracle database. the meantime, it gives me bunch of errors while recreating it. is there any documentation of datatables using oracle database? thanks in advance!!