2 messages in com.mysql.lists.javaRe: Why are batches faster than singl...| From | Sent On | Attachments |
|---|---|---|
| Kevin A. Burton | 20 Aug 2004 15:36 | |
| Ronald Klop | 23 Aug 2004 04:59 |
| Subject: | Re: Why are batches faster than single queries within DB pools?![]() |
|---|---|
| From: | Ronald Klop (rona...@base.nl) |
| Date: | 08/23/2004 04:59:54 AM |
| List: | com.mysql.lists.java |
http://dev.mysql.com/doc/mysql/en/Insert_speed.html
Batched queries do locking and syncing of the disk only ones. This saves a lot
of overhead.
And it sends the queries at ones over the network, which saves a lot of delays
in the communication.
Ronald.
On Sat Aug 21 00:36:53 CEST 2004 "Kevin A. Burton" <bur...@newsmonster.org>
wrote:
Why is it that batched updates are MUCH faster than the same amount of single queries within a DB conn pool.
For example if I have to do 300 updates... one at a time... it will take about 300ms. (1ms per update on a small table). If I rewrite this code to use a batch update it takes about 2ms. This is MUCH faster obviously. 150x... This is with the SAME connection so I'm not sure why it would be so much slower.
I don't have time to dive into this portion of the code but wanted to see if anyone had any pointers. In the pooling/latency discussion in a previous thread Mark Matthews said:
For a SELECT, I get less 2 tenths of a millisecond on my lowly PIII laptop,. The test is also running inside Eclipse, so it tends to be a bit slower as well. Looking at the test run in a profiler, shows that well over half that time is spent inside I/O in the Java class libraries.
What did the stack look like? Is it possible to make this more efficient?
I can't see any reason why Java should be *any* slower than just the raw IO latency.
I need to get a good profiler working... ug.
--
Please reply using PGP.
http://peerfear.org/pubkey.asc
NewsMonster - http://www.newsmonster.org/
Kevin A. Burton, Location - San Francisco, CA, Cell - 415.595.9965 AIM/YIM - sfburtonator, Web - http://peerfear.org/ GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412 IRC - freenode.net #infoanarchy | #p2p-hackers | #newsmonster
-- MySQL Java Mailing List For list archives: http://lists.mysql.com/java To unsubscribe: http://lists.mysql.com/java?unsub=rona...@base.nl




