MDL-78030 dml: get total count records using the window function

The COUNT window function can be helpful to fasten the complex query,
but it's not recommended to be used for a single table query.

The patch is specifically for PostgreSQL, MariaDB and Oracle databases as they have better performance
compared to MySQL and MSSQL. Although these databases support the COUNT window functions,
the results indicate that the query runs slower when using them.
This commit is contained in:
meirzamoodle
2024-07-29 13:53:46 +07:00
parent 1a33da6637
commit 42664ee49a
6 changed files with 194 additions and 0 deletions
+9
View File
@@ -1722,4 +1722,13 @@ class pgsql_native_moodle_database extends moodle_database {
public function is_fulltext_search_supported() {
return true;
}
/**
* Postgresql supports the COUNT() window function and provides a performance improvement.
*
* @return bool
*/
public function is_count_window_function_supported(): bool {
return true;
}
}