Skip to content

Comments

[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
richard67:3.x-dev-mysql-sql-big-select
Closed

[3.x-dev] New option to set sql_big_selects on MySQL/MariaDB#285
richard67 wants to merge 9 commits intojoomla-framework:3.x-devfrom
richard67:3.x-dev-mysql-sql-big-select

Conversation

@richard67
Copy link
Contributor

@richard67 richard67 commented Jul 22, 2023

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:

  • Option sqlBigSelects for the sql_big_selects variable
  • Option maxJoinSize for the max_join_size variable

When a particular option is not used, nothing is done, i.e. any value of the corresponding session variable will not be changed.

When the maxJoinSize option is used, the sqlBigSelects will not be used because MySQL and MariaDB will automatically set the sql_big_selects variable to OFF (0) when the max_join_size variable is set.

When the sqlBigSelects option is used and equal to true, the maxJoinSize will not be used because MySQL and MariaDB will ignore the value of the max_join_size variable when the sql_big_selects variable is set to ON (1).

The maxJoinSize option is defined as string and not as integer or float because the maximum value of 18446744073709551615 is beyond everything which we can handle as integer value in PHP and also not precise when using a float.

See following documentation:

This will allow clients like e.g. Joomla CMS to set sql_big_selects to ON or max_join_size to a suitable value when they run into the SQL error 1104 The 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.

@richard67
Copy link
Contributor Author

Closing in favour of #293 and #294 .

@richard67 richard67 closed this Dec 21, 2023
@richard67 richard67 deleted the 3.x-dev-mysql-sql-big-select branch December 21, 2023 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant