What is maximum query size for mysql? Some times the server stops working when I fire a too long query.
2 Answers
You can check your current server setting with:
SHOW VARIABLES LIKE 'max_allowed_packet';
This gives you the answer in bytes. for e.g max_allowed_packet=1048576
or 1 MiB
-
If it's in bytes, then the 1mb from answer is about 8 times smaller. Oct 5, 2017 at 10:36
-
7It seems that this answer implies that the maximum query length is only limited by the maximum packet size that can be sent to the server. This basically means that there is no upper limit to query lengths as long as you're able to send it to the server.– jlhApr 6, 2018 at 9:03
To increase the max_allowed_packet
, open
my.ini/my.cnf
under [mysqld]
section.
Once the change is done you would have to restart the server.
-
3Using "128MB", "1GB", etc is allowed. The value does not have to be in bytes (but it is supported). Max value is 1GB. If you set it to more than 1GB, mysql will still start normally, but it will not accept anything over 1GB. Nov 22, 2021 at 8:19
SHOW VARIABLES LIKE 'max_allowed_packet';