From dfa0f3f03a7b6e17fb7ad0288eec503ead458e9f Mon Sep 17 00:00:00 2001 From: JediKev <kevin@enhancesoft.com> Date: Tue, 8 May 2018 11:48:46 -0500 Subject: [PATCH] issue: Information Page Performance This addresses an issue on the forums where the query to determine the size of the `file_chunk` table is making the page load really slow for people with large tables. This updates the query to improve the performance of the page load time. --- include/staff/system.inc.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/include/staff/system.inc.php b/include/staff/system.inc.php index 20198b8f8..a1341fd01 100644 --- a/include/staff/system.inc.php +++ b/include/staff/system.inc.php @@ -154,7 +154,17 @@ if (!$lv) { ?> echo sprintf('%.2f MiB', $space); ?></td> <tr><td><?php echo __('Space for Attachments'); ?></td> <td><?php - $sql = 'SELECT SUM(LENGTH(filedata)) / 1048576 FROM '.FILE_CHUNK_TABLE; + $sql = 'SELECT + (DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024 + FROM + information_schema.TABLES + WHERE + TABLE_SCHEMA = "'.DBNAME.'" + AND + TABLE_NAME = "'.FILE_CHUNK_TABLE.'" + ORDER BY + (DATA_LENGTH + INDEX_LENGTH) + DESC'; $space = db_result(db_query($sql)); echo sprintf('%.2f MiB', $space); ?></td></tr> <tr><td><?php echo __('Timezone'); ?></td> -- GitLab