From 0fa4107dfc58e3196b9de81c427a3cd197b2e685 Mon Sep 17 00:00:00 2001 From: jamiesensei Date: Sun, 20 Jul 2008 12:21:59 +0000 Subject: [PATCH] MDL-15719 "overview report slow for large data sets - count sql operation for table paging repeated twice whether or not it is necessary" --- lib/tablelib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tablelib.php b/lib/tablelib.php index dadf87074d..e682d02898 100644 --- a/lib/tablelib.php +++ b/lib/tablelib.php @@ -1187,8 +1187,10 @@ class table_sql extends flexible_table{ if ($this->get_sql_where()) { $this->countsql .= ' AND '.$this->get_sql_where(); $this->sql->where .= ' AND '.$this->get_sql_where(); + $total = $DB->count_records_sql($this->countsql, $this->countparams); + } else { + $total = $totalinitials; } - $total = $DB->count_records_sql($this->countsql, $this->countparams); $this->pagesize($pagesize, $total); -- 2.39.5