php - Pulling 1000+ records from MySQL, need advice -
i'm attempting pull on thousand records mysql db using php , due long load time i'm curious if there better way write query.
function propigatetable($connection) { $sql = mysqli_query($connection, "select `id`, `legalname`, `doingbusinessas`, `creationdate`, `modifieddate`, `status` `merchants` `deleted` = '0' order `creationdate` desc"); while($merchant = mysqli_fetch_array($sql)){ $id = $merchant["id"]; $legalname = $merchant["legalname"]; $doingbusinessas = $merchant["doingbusinessas"]; $creationdate = date('d, m j y', strtotime($merchant["creationdate"])); if ($merchant["modifieddate"] != "0000-00-00 00:00:00") { $modifieddate = date('d, m j y', strtotime($merchant["modifieddate"])); } else { $modifieddate = ""; } if ($merchant["status"] == "inactive") { $status = "class='warning' data-toggle='tooltip' data-placement='top' data-container='body' title='this account marked inactive.'"; } ... }
if there no other route available, appreciate pointer how implement "loading icon" while data being fetched.
edit: table indexed, here table structure:
name id status legalname doingbusinessas businessinformation principalinformation creationdate createdby modifieddate modifiedby deleted pastdue delinquent type int(11) tinytext tinytext tinytext text text datetime int(11) datetime int(11) tinyint(1) tinyint(1) tinyint(1)
currently page takes 4-5 seconds load. assumed due queries have discovered culprit: bootstrap datatables plugin. it's sorting of tables takes long, not pulling data server. i'm sorry frustrated people attempting me figure out, didn't realize leaving critical information post.
i assumed due queries have discovered culprit: bootstrap datatables plugin. it's sorting of tables takes long, not pulling data server.
Comments
Post a Comment