By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,721 Members | 1,206 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,721 IT Pros & Developers. It's quick & easy.

Maximum length of MySQL query?

P: n/a
Does anyone know if there's an upper limit to the length of the query
string supplied to the mysql_query() function? It appears that strings
themselves can go well beyond 65,536 characters: the PHP manual does not
seem to specify the upper limit, but in one test I was able to construct
a 1,000,960 character string without a hitch.

The queries my code will construct will be considerable smaller --
between 3,500 characters and roughly 20,000 characters. Can anyone tell
me if a 20,000-character UPDATE will cause problems, given the code
below and assuming that the $updateSQL string contains valid MySQL code:

$database_VoIP_Connection = ...;
$VoIP_Connection = ...;
$updateSQL = "UPDATE ... SET ... WHERE ...";
mysql_select_db($database_VoIP_Connection, $VoIP_Connection);
$Result1 = mysql_query($updateSQL, $VoIP_Connection) or
die(mysql_error());

I can chop up the query into smaller pieces if need be, but I'd rather
execute a single UPDATE for speed and simplicity.
-- Bert Sierra
Tempered MicroDesigns
Prescott, AZ
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
py
Bert Sierra wrote:
Does anyone know if there's an upper limit to the length of the query
string supplied to the mysql_query() function? It appears that strings
themselves can go well beyond 65,536 characters: the PHP manual does not
seem to specify the upper limit, but in one test I was able to construct
a 1,000,960 character string without a hitch.

The queries my code will construct will be considerable smaller --
between 3,500 characters and roughly 20,000 characters. Can anyone tell
me if a 20,000-character UPDATE will cause problems, given the code
below and assuming that the $updateSQL string contains valid MySQL code:

$database_VoIP_Connection = ...;
$VoIP_Connection = ...;
$updateSQL = "UPDATE ... SET ... WHERE ...";
mysql_select_db($database_VoIP_Connection, $VoIP_Connection);
$Result1 = mysql_query($updateSQL, $VoIP_Connection) or
die(mysql_error());

I can chop up the query into smaller pieces if need be, but I'd rather
execute a single UPDATE for speed and simplicity.
-- Bert Sierra
Tempered MicroDesigns
Prescott, AZ


20,000-character should work fine with mysql > 4

Look here for more info:
http://www.devshed.com/c/a/MySQL/Tro...QL-Programs/4/

py
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.