Comments - WITH RECURSIVE limited to 1001 records?

1 year, 7 months ago Ian Gilfillan

You don't specify your version, but since MariaDB 10.6, max_recursive_iterations has defaulted to 1000. It can be increased up to 4294967295.

 
1 year, 7 months ago Dario Vanin

Hi Ian,

Here below my version.

mariadb Ver 15.1 Distrib 10.6.5-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Since I am running it on a container, is it possible to increase that limit on the 50-server.cnf or by using a global variable instead? I tried adding the following line to a stored procedure with no luck.

SET GLOBAL max_recursive_iterations = 100000;

Output:

MariaDB [worthmap_db]> CALL sp_daterange();
+--------------------------+--------+
| Variable_name            | Value  |
+--------------------------+--------+
| max_recursive_iterations | 100000 |
+--------------------------+--------+
1 row in set (0.007 sec)

+--------------------+------------+-------------+
| input_product_code | this_day   | daily_value |
+--------------------+------------+-------------+
| ASX-ASB.AX         | 2010-01-03 |           0 |
| ASX-ASB.AX         | 2010-01-04 |           0 |


[...]

| ASX-ASB.AX         | 2012-09-29 |           0 |
+--------------------+------------+-------------+
1001 rows in set (0.008 sec)

Query OK, 2 rows affected (0.050 sec)

Thanks for helping me! Dario

 
1 year, 7 months ago Ian Gilfillan

If you set the global value, it does not change the current session value, only those of any subsequent sessions. SET SESSION max_recursive_iterations = 100000 should work. If you want the change to persist, then you will need to set it in a config file, which is read upon start.

 
1 year, 7 months ago Dario Vanin

It worked. Thank you so much :-)

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.