Maximum length of MySQL query?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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

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

Re: Maximum length of MySQL query?

Bert Sierra wrote:
Quoted text here. Click to load it

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

Look here for more info: /


Site Timeline