Speed up the dashboard and the menu counts on installs with years of history: database 3.6.4 adds seven indexes, each only where it is missing and also in db.sql for new installs - tickets on ticket_resolved_at, ticket_closed_at and ticket_created_at, a five-column one led by ticket_billable that answers the unbilled count from the index alone, ticket_replies on ticket_reply_by with ticket_reply_created_at, invoices on invoice_status and expenses on expense_date - so open tickets, unpaid invoices, an agent time this week and unbilled tickets are found directly, where each was a read of the whole table, a dozen times over tickets on the dashboard and twice in the menu on every page; dashboardPeriodOptions finds the years with data with one index step a year per table in place of a UNION of YEAR over every row of five tables, and dashboardLatestIncome joins from payments with STRAIGHT_JOIN so the last five are read off payment_date, where every payment was sorted; measured on 280,000 tickets, 380,000 replies and 70,000 invoices the dashboard went from 5.1s to 0.7s and other pages lost about half a second, with every figure unchanged; also fix lists past 10,000 pages, where includes/filter_footer.php left the pager step unset and a division by zero ended the page at its page numbers; add a 26.11.7 changelog section

This commit is contained in:
johnnyq
2026-11-11 14:13:11 -05:00
parent 914d1c549a
commit 5ba8ffc0cf
5 changed files with 145 additions and 24 deletions

View File

@@ -72,14 +72,11 @@ if ($total_found_rows > 5) {
<?php
if ($total_pages <= 100) {
$pages_split = 10;
}
if (($total_pages <= 1000) && ($total_pages > 100)) {
$pages_split = 100;
}
if (($total_pages <= 10000) && ($total_pages > 1000)) {
$pages_split = 1000;
// Every 10th page is linked up to 100 pages, every 100th up to 1,000, and so on up -
// past 10,000 pages this had no value, and the division below ended the page
$pages_split = 10;
while ($pages_split * 10 < $total_pages) {
$pages_split *= 10;
}
if ($page > 1) {
$prev_class = "";