[3.x-dev] New option to set sql_big_selects on MySQL/MariaDB#285
Closed
richard67 wants to merge 9 commits intojoomla-framework:3.x-devfrom
Closed
[3.x-dev] New option to set sql_big_selects on MySQL/MariaDB#285richard67 wants to merge 9 commits intojoomla-framework:3.x-devfrom
richard67 wants to merge 9 commits intojoomla-framework:3.x-devfrom
Conversation
This was referenced Jul 22, 2023
Closed
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request for CMS issues joomla/joomla-cms#39479 and joomla/joomla-cms#41156 .
Alternative to PR #266 and same as PR #284 , but here for the 3.x-dev branch.
Summary of Changes
This Pull Request (PR) adds 2 new options to the MySQLi and MySQL (PDO) drivers to set corresponding session variables after connecting to the database:
sqlBigSelectsfor thesql_big_selectsvariablemaxJoinSizefor themax_join_sizevariableWhen a particular option is not used, nothing is done, i.e. any value of the corresponding session variable will not be changed.
When the
maxJoinSizeoption is used, thesqlBigSelectswill not be used because MySQL and MariaDB will automatically set thesql_big_selectsvariable toOFF(0) when themax_join_sizevariable is set.When the
sqlBigSelectsoption is used and equal totrue, themaxJoinSizewill not be used because MySQL and MariaDB will ignore the value of themax_join_sizevariable when thesql_big_selectsvariable is set toON(1).The
maxJoinSizeoption is defined as string and not as integer or float because the maximum value of18446744073709551615is beyond everything which we can handle as integer value in PHP and also not precise when using a float.See following documentation:
and https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_big_selects
and https://mariadb.com/kb/en/server-system-variables/#sql_big_selects
This will allow clients like e.g. Joomla CMS to set
sql_big_selectstoONormax_join_sizeto a suitable value when they run into the SQL error 1104The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay..In addition to that, this PR adds the necessary functions to get the current values of these 2 session variables so they can be shown in a client, e.g. in the System Information of the Joomla CMS Administrator.
Testing Instructions
Will be added soon. As long as this is not done, I will keep this PR in draft status.
Documentation Changes Required
None.