On Tue, Feb 26, 2019 at 9:54 PM Daniel Theophanes <
kard...@gmail.com> wrote:
>
> Speaking of MySQL, I'm familiar with SQL Server and postgresql "bulk load", but not so much with MySQL. Would I be correct there isn't a dedicated interface for such, but a more efficient insert?
>
The answer is not simple.
MySQL has "LOAD LOCAL INFILE" statement. It uploads local csv file to server.
It is much faster than insert statement. This is the best way.
https://dev.mysql.com/doc/refman/8.0/en/insert-optimization.html
But if you expects "prepare and batched execute" protocol, it is
different thing.
MySQL has two protocols: C/S protocol and X protocol.
C/S is long lived, standard protocol. MariaDB and PerconaDB supports it.
There is "prepare" and "exec" command in the protocol. But it
requires one roundtrip
for each rows inserted.
So we used "query" command instead. It sends text query. So we need to build
SQL like "INSERT INTO ... VALUES (a1, a2, a3), (b1, b2, b3,) ... (x1, x2, x3)".
While MariaDB uses same protocol, it extend the protocol. So there is
"batched exec" command. But it can't be used for MySQL. (I don't know much
about PerconaDB).
New X protocol supports pipelined exec. But it is very young protocol and
under heavy development.
MariaDB and PerconaDB doesn't support it. X protocol doesn't support
compression
which C/S protocol supports. So X protocol is not widely used yet.
This is current situation of MySQL protocol world.
--
INADA Naoki <
songof...@gmail.com>