{question}
How do I overcome a limit set by a client?
Is there any way to bypass the limit statement while not significantly altering the query?
{question}
{answer}
The variable sql_select_limit means the maximum number of rows returned by SELECT queries.
If you set it to a significant number 18446744073709551615, the limit setting will not affect the plan.
Please check the example below:
memsql> set sql_select_limit = 18446744073709551615;
Query OK, 0 rows affected (0.000 sec)
memsql> explain select 1;
+------------------+
| EXPLAIN |
+------------------+
| Project [1 AS 1] |
+------------------+
1 row in set (0.002 sec)
memsql> set sql_select_limit = 18446744073709551614;
Query OK, 0 rows affected (0.000 sec)
memsql> explain select 1;
+------------------------------------------+
| EXPLAIN |
+------------------------------------------+
| Project [1 AS 1] |
| Top limit:[@@SESSION.`sql_select_limit`] |
+------------------------------------------+
2 rows in set (0.002 sec)
{answer}