Comments (3)
My question is very similar with this, but it seems that using strlen
cannot get current query size to compare to max allowed packet size.
from db.
Hi, it will be hard to implement this feature as I don't think the packet size calculation is easy (the packet is probably bigger than the length of the query and the parameters). I would suggest you calculate the total length of your parameters, multiply this by the number of inserts per query you're planning to use, and take some margin (like half the max packet size) to be on the safe side.
Then adjust the max_allowed_packet
or the inserts per query accordingly!
from db.
Hi @BenMorel, thanks for your reply.
You're right. It's hard to calculate current query size. Even use the strlen
function to calculate query size in PHP is not correct.
I think the only way is like you suggest.
Using the half length of max_allowed_packet
size to ensure that every bulk insertion queries will be worked without Got a packet bigger than 'max_allowed_packet' bytes
message :).
from db.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from db.