I have 25,000 entries in my table and when I retrieve data from my table.. it almost take 30 secs or 1 min. I tried using DESC LIMIT and added index to my column but still doesn't work. How can I get my data in a faster way?
this is my table_structure
id (int 255)
date_sourced (date)
sha1 (varchar 255)
vsdtt (varchar 255)
trendx (varchar 255)
notes (varchar 255)
My desc limit is like this, user can Input how many values can be displayed
Here is my query:
$rpp = 10;
$page = 1;
$conn = mysqli_connect("localhost", "root", "", "jeremy_db");
$query_count = " SELECT * FROM jeremy_table_trend ORDER by date_sourced desc ";
$result_count = mysqli_query($conn, $query_count);
$total = mysqli_num_rows($result_count);
$temp = ($page-1)*$rpp;
$query = " SELECT * FROM jeremy_table_trend ORDER by date_sourced desc LIMIT $rpp ";
$page_result = mysqli_query($conn, $query);
Then my table to display the values from db:
<?php while($row = mysqli_fetch_assoc($page_result)) { $currsamp_id = $row['id'];?>
<tr>
<td><input class="ui checkbox" type="checkbox" name="check_box" value="<?php echo $row['id'] ?>"></td>
<td onclick="$('#options_<?php echo $currsamp_id ?>').dropdown('show')" style="overflow: visible !important;"> </td>
<div class="ui dropdown item" id="options_<?php echo $currsamp_id ?>">
<i class="settings icon"></i><i class="dropdown icon"></i>
</div>
<td nowrap title="Date Sourced"><?php echo $row['date_sourced'] </td>
<td nowrap title="SHA-1"><?php echo $row['sha1'] ?></td>
<td nowrap title="VSDT"><?php echo $row['vsdt'] ?></td>
<td nowrap title="TrendX"><?php echo $row['trendx'] ?></td>
<td nowrap title="Notes"><?php echo $row['notes'] ?></td>
</tr>
<?php } ?>