moodle/.upgradenotes/MDL-78030-2024071102213324.yml
meirzamoodle 42664ee49a 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.
2024-07-29 13:53:46 +07:00

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