Re: Insert speed (JDBC and MySQL)
- From: Mark Matthews <mark@xxxxxxxxx>
- Date: Tue, 24 Jan 2006 09:39:16 -0600
John wrote:
> Hi,
>
> I am writing a program that needs to typically carry out around 100,000
> INSERTs to a mysql database. I would normally load the data using a text
> file, but in this case, there is the occasional query required (evenly
> spread through, and dependent on, the INSERTs).
>
> I had the program connecting to a remote database and was achieving
> around 47ms per INSERT. I thought that connecting to the database
> locally would improve the speed, but it is unchanged at around 47ms.
>
> This compares (very) unfavourably with the 0.3 ms that can be achieved
> by piping a text file of sql into the command line tool.
>
> Does anyone know how to improve the performance of these INSERTs?
>
> Similarly, what speeds can be achieved for INSERTS using JDBC? (using
> one sensible machine only).
>
> Thanks,
>
> John
John,
How are your inserts crafted? Without knowing that, you're comparing
apples and oranges.
I can load 100 thousand rows using JDBC in just under a second over
100mbit ethernet via batched inserts (i.e. of the form INSERT INTO foo
VALUES (...), (...), (...)), so you've definitely got something not
efficient with the way you're doing it.
-Mark
.
- Follow-Ups:
- Re: Insert speed (JDBC and MySQL)
- From: John
- Re: Insert speed (JDBC and MySQL)
- References:
- Insert speed (JDBC and MySQL)
- From: John
- Insert speed (JDBC and MySQL)
- Prev by Date: Insert speed (JDBC and MySQL)
- Next by Date: Re: Insert speed (JDBC and MySQL)
- Previous by thread: Insert speed (JDBC and MySQL)
- Next by thread: Re: Insert speed (JDBC and MySQL)
- Index(es):
Relevant Pages
|
|