# give/4.16.8.1/src/Framework/Database/Actions/EnableBigSqlSelects.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.16.8.1. 35 lines.

- Page: https://pluginprobe.com/plugins/give/4.16.8.1/code/src/Framework/Database/Actions/EnableBigSqlSelects.php
- Raw: https://pluginprobe.com/plugins/give/4.16.8.1/raw/src/Framework/Database/Actions/EnableBigSqlSelects.php
- Modified: 2022-08-18T18:28:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.16.8.1/code/src/Framework/Database/Actions/EnableBigSqlSelects.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace Give\Framework\Database\Actions;

class EnableBigSqlSelects
{
    /**
     * @since 2.22.0
     *
     * Enables mysql big selects for the session using a session system variable.
     *
     * This is necessary for hosts that have an arbitrary MAX_JOIN_SIZE limit, which prevents more complex queries from
     * running properly. Setting SQL_BIG_SELECTS ignores this limit. This is also done by WooCommerce, supporting the
     * idea that this is a viable option. There also doesn't seem to be a way for hosts to prevent this.
     *
     * @see https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_sql_big_selects
     * @see https://dev.mysql.com/doc/refman/5.7/en/system-variable-privileges.html
     *
     */
    public function __invoke()
    {
        static $bigSelects = false;

        if (!$bigSelects) {
            global $wpdb;

            $wpdb->query('SET SESSION SQL_BIG_SELECTS=1;');

            $bigSelects = true;
        }
    }
}

```
