From: Michael Widenius Date: March 8 2009 12:29pm Subject: Re: remote binary bulk inserts from background thread in MySQL server List-Archive: http://lists.mysql.com/internals/36360 Message-Id: <18867.47677.781545.451176@narttu.askmonty.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! >>>>> "Sergei" == Sergei Golubchik writes: Sergei> Hi, Andrej! Sergei> On Mar 05, Andrej van der Zee wrote: >> Hi, >> >> I was wondering if it is possible to efficiently bulk-insert binary >> rows in a remote MySQL server. In my setup, currently I collect >> low-level resource data for each MySQL query. I modified the >> server-code to read hardware counters and write the results in >> (binary) bulk inserts into tables in the same database server. This is >> done in a background thread. But, now I would like to write the >> binary data to a remote MySQL server as efficient as possible, i.e. >> without (de)serializing the binary data to strings before it goes over >> the wire. To make a long story short, is it possible to do binary bulk >> inserts to a remote MySQL server from within a background thread in a >> MySQL server? How could I do this? Sergei> Either by using the client API and prepared statements - then you won't Sergei> need to convert your binary data to strings, and you can bulk-insert many Sergei> rows at once. At this moment, the fastest way to do it is to write things to a file on the client side and then issue a 'load data local infile' to read the file. If there are many rows, the binary to string to binary are convertes are neglected compared to the effiency increase you get by using the local infile protocol. Regards, Monty