Discussion:
MySQL statement length
(too old to reply)
Roy Epperson
2007-01-14 02:12:03 UTC
Permalink
I'm not finding what the maximum number of characters that a statement
can be. Anyone know where I can find that spec?
Bill Karwin
2007-01-15 00:11:38 UTC
Permalink
Post by Roy Epperson
I'm not finding what the maximum number of characters that a statement
can be. Anyone know where I can find that spec?
I have found it hard to find this stat as well. I could not find a
definitive answer, but I believe the maximum length of a SQL statement
is 1MB.

It may be the case that the programming interface you use may impose a
shorter limit on the query length than that supported by the MySQL server.

Regards,
Bill K.
Roy Epperson
2007-01-15 17:27:19 UTC
Permalink
Thanks Bill, I suspect that JDBC will allow close to that....
Post by Bill Karwin
Post by Roy Epperson
I'm not finding what the maximum number of characters that a statement
can be. Anyone know where I can find that spec?
I have found it hard to find this stat as well. I could not find a
definitive answer, but I believe the maximum length of a SQL statement
is 1MB.
It may be the case that the programming interface you use may impose a
shorter limit on the query length than that supported by the MySQL server.
Regards,
Bill K.
Michael Austin
2007-01-15 02:47:04 UTC
Permalink
Post by Roy Epperson
I'm not finding what the maximum number of characters that a statement
can be. Anyone know where I can find that spec?
Are you having problems or just looking for some spec?

http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html

" A communication packet is a single SQL statement sent to the MySQL server, a
single row that is sent to the client, or a binary log event sent from a master
replication server to a slave.

The largest possible packet that can be transmitted to or from a MySQL 5.0
server or client is 1GB."

The C API is limited appears to be 16Mb.

Is there some reason for creating a single statement that long?
--
Michael Austin
Database Consultant
Domain Registration and Linux/Windows Web Hosting Reseller
http://www.spacelots.com
Roy Epperson
2007-01-15 17:32:37 UTC
Permalink
Michael,
Not having a problem and don't expect to if the JDBC limit is close to
the C API limit. I've using a `select * from aTable where columnName in
(<list_of_primary_keys>)` statement there the primary key is an
autonumber.
Roy
Post by Michael Austin
Post by Roy Epperson
I'm not finding what the maximum number of characters that a statement
can be. Anyone know where I can find that spec?
Are you having problems or just looking for some spec?
http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html
" A communication packet is a single SQL statement sent to the MySQL
server, a single row that is sent to the client, or a binary log event
sent from a master replication server to a slave.
The largest possible packet that can be transmitted to or from a MySQL
5.0 server or client is 1GB."
The C API is limited appears to be 16Mb.
Is there some reason for creating a single statement that long?
Loading...