-
Notifications
You must be signed in to change notification settings - Fork 2.3k
LOAD LOCAL can send file larger than max_allowed_packet #424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
And max_allowed_packet may be too big for each packet. Use 16KB (default value of net_buffer_length) instead.
@methane I like this - thank you! Looks like very sound reasoning. |
Benchmarking this in real world is bit hard. It's heavily rely on slow disk read and stable server performance. I don't have good environment to test this for now. But I can emulate in toy program. loadfile.go
dstat for 16mb show iowait:
There are no iowait in dstat for 16KB:
I ran this benchmark on VirtualBox. Small read may be faster on real environment since |
I don't know about how MySQL server handle "LOAD LOCAL INFILE". |
That's good enough for me - and reproducible by whoever wants to do so. |
LOAD LOCAL can send file larger than max_allowed_packet
Description
"LOAD LOCAL INFILE" query can send file larger than
max_allowed_packet
. But go-sql-driver/mysql returns error when file is large.http://dba.stackexchange.com/questions/13160/does-the-max-allowed-packet-variable-have-any-effect-on-load-local-infile
Additionally, some user set
max_allowed_packet
very large (e.g. 1GB).Since max size of MySQL packet is 16MB, using it for buffer size is not good.
Typical readahead buffer size of Linux is 128KB. So large buffer size may cause performance penalty. (#364).
I choose 16KB for buffer size (default of
net_buffer_length
, http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_net_buffer_length).Checklist