mirror of
https://github.com/moodle/moodle.git
synced 2025-02-25 20:43:33 +01:00
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.
19 lines
752 B
YAML
19 lines
752 B
YAML
issueNumber: MDL-78030
|
|
notes:
|
|
core:
|
|
- message: |
|
|
Two new functions have been introduced in the \moodle_database class:
|
|
- `get_counted_records_sql()`
|
|
- `get_counted_recordset_sql()`
|
|
These methods are compatible with all databases.
|
|
They will check the current running database engine and apply the COUNT window function if it is supported,
|
|
otherwise, they will use the usual COUNT function.
|
|
|
|
The COUNT window function optimization is applied to the following databases:
|
|
- PostgreSQL
|
|
- MariaDB
|
|
- Oracle
|
|
MySQL and SQL Server do not use this optimization due to insignificant performance differences before and
|
|
after the improvement.
|
|
type: improved
|