Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8753351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:24:30+00:00 2026-06-13T13:24:30+00:00

How can I determine the maximum $query parameter received by function mysqli_multi_query (or mysqli_query),

  • 0

How can I determine the maximum $query parameter received by function mysqli_multi_query (or mysqli_query), in PHP?
I have a php program which generates a large string made of UPDATE sql commands, separated by ‘;’ The Problem is that if that string exceeds a certain length mysqli_query generates an error like ‘MySQL server has gone away’. I notice that that length seems to be around 1MB, but how can I probe-it so that I can make sure that I never exceed that length?

The script needs to run about 7000 updates, on 25 or so fields. Executing one update at a time proved very slow, Concatenating multiple updates runs much faster.

Any possibility to run multiple queries even faster?

Thanck you for any advice!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:24:31+00:00Added an answer on June 13, 2026 at 1:24 pm

    You should take a look at MySQL error logs.

    If you dont have access to machine (hosting etc) you may ask your administrator or helpdesk for that log.

    MySQL supports very big queries. Im not sure if there is any limit, but when you are using network – you may have problem with packet size.

    You may check --max_allowed_packet in MySQL configuration, and try to set bigger packet size. Im not sure about default configuration, but it may be 1MB which may be too small value to get query with 7000 updates at once.

    MySQL may need more RAM to process query like this.

    If you cant reconfigure MySQL you have to split your big query to smaller queries somehow.

    You may also read this for more information:

    devshed – MySQL server has gone away

    You asked:

    Any possibility to run multiple queries even faster?

    there is no simple answer for that question. It depends on query, database schema etc.

    Increasing MySQL cache size in configuration file may help a lot in most cases related with big simple updates with not much computing, because database engine will operate on RAM memory, not on hard disk. When big cache is used – sometimes first big query may be slower, because data is not yet loaded into RAM, but when it finally loads – queries that need a lot of read/write operations will work much faster.

    Added later:
    I assume your data processing needs php deserialize() function which may be hard to implement in pure SQL and you have to do it in PHP 🙂 If you have access to server console you may create cron (linux sheduler) job, that call PHP script from shell during night.

    Added later later
    After discussion in comments i have one more idea. You can make full database or one table backup from phpmyadmin, download it, restore data on home computer (on Windows you may use XAMPP, WAMP server). On your home computer you can run mysql.exe and process data locally.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What factors determine the maximum amount of physical memory a system can have? I
I have a function I'm using to determine the absolute maximum size an image
I have been able to create php function to determine a list of zip
How can I determine the maximum number of threads running in my pc or
How can I portably determine the maximum value of the pid_t type? There's no
Today I have encountered a problem that required me to determine the maximum index
I have few questions as below: 1) I have a Java program which tryning
How can I determine the maximum filename length on a linux box? Preferred in
What is the best way to show friends' posts? Each user can have maximum
I have a function in java which is written with a recursive algorithm that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.