Link to home
Start Free TrialLog in
Avatar of Ray Paseur
Ray PaseurFlag for United States of America

asked on

Practical Limit on Length of MySQLi Query String

I'm building an export application to run against a table with about 20,000 rows.  Each row needs to be written to the output file, then the row will be marked by changing the "exported" column from default 'N' to 'Y' so that we know which rows have been exported.

The idea of running 20,000 update queries makes me itch, so I was thinking along the lines of using a single query with a clause like WHERE id IN (1,2,3,4,5 ... 20000)

It seems like this query string might be nearly 100,000 characters.  

Is there a practical limit on the length of the query string?  Or any other "gotcha" lurking in this idea?

Is there a "best practice" way of doing something like this?

Response time is not a big issue; this will probably run once a day.

Thanks and regards, ~Ray
ASKER CERTIFIED SOLUTION
Avatar of mankowitz
mankowitz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ray Paseur

ASKER

Great!  That's exactly what I was looking for.

stdClass Object
(
    [Variable_name] => max_allowed_packet
    [Value] => 33554432
)
Many thanks! ~Ray