pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedMultiple Row Insert vs. Batch
11+ messages / 5 participants
[nested] [flat]
* Multiple Row Insert vs. Batch
@ 2015-06-06 16:34 Robert DiFalco <robert.difalco@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: Robert DiFalco @ 2015-06-06 16:34 UTC (permalink / raw)
To: pgsql-jdbc
Say I need to insert 250 rows. Is single-statement multiple row insert or
JDBC batch likely to be faster?
Thanks!
R.
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Multiple Row Insert vs. Batch
@ 2015-06-06 17:29 Dave Cramer <pg@fastcrypt.com>
parent: Robert DiFalco <robert.difalco@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: Dave Cramer @ 2015-06-06 17:29 UTC (permalink / raw)
To: Robert DiFalco <robert.difalco@gmail.com>; +Cc: pgsql-jdbc
batch should be faster and if it isn't we did something wrong
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
On 6 June 2015 at 12:34, Robert DiFalco <robert.difalco@gmail.com> wrote:
> Say I need to insert 250 rows. Is single-statement multiple row insert or
> JDBC batch likely to be faster?
>
> Thanks!
>
> R.
>
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Multiple Row Insert vs. Batch
@ 2015-06-06 17:34 Vitalii Tymchyshyn <vit@tym.im>
parent: Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 11+ messages in thread
From: Vitalii Tymchyshyn @ 2015-06-06 17:34 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; Robert DiFalco <robert.difalco@gmail.com>; +Cc: pgsql-jdbc
I think OP meant something like
Insert into table values (?,?,?),(?,?,?),...,(?,?,?);
Vs batch of insert into table values(?,?,?);
I really think first would be faster up to a certain amount of rows, but
test is needed to check.
Vitalii Tymchyshyn
Сб, 6 черв. 2015 13:30 Dave Cramer <pg@fastcrypt.com> пише:
> batch should be faster and if it isn't we did something wrong
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
> On 6 June 2015 at 12:34, Robert DiFalco <robert.difalco@gmail.com> wrote:
>
>> Say I need to insert 250 rows. Is single-statement multiple row insert or
>> JDBC batch likely to be faster?
>>
>> Thanks!
>>
>> R.
>>
>
>
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Multiple Row Insert vs. Batch
@ 2015-06-06 17:35 Dave Cramer <pg@fastcrypt.com>
parent: Vitalii Tymchyshyn <vit@tym.im>
0 siblings, 1 reply; 11+ messages in thread
From: Dave Cramer @ 2015-06-06 17:35 UTC (permalink / raw)
To: Vitalii Tymchyshyn <vit@tym.im>; +Cc: Robert DiFalco <robert.difalco@gmail.com>; pgsql-jdbc
Robert ??
Is that what you meant ?
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
On 6 June 2015 at 13:34, Vitalii Tymchyshyn <vit@tym.im> wrote:
> I think OP meant something like
> Insert into table values (?,?,?),(?,?,?),...,(?,?,?);
> Vs batch of insert into table values(?,?,?);
>
> I really think first would be faster up to a certain amount of rows, but
> test is needed to check.
>
> Vitalii Tymchyshyn
>
> Сб, 6 черв. 2015 13:30 Dave Cramer <pg@fastcrypt.com> пише:
>
> batch should be faster and if it isn't we did something wrong
>>
>> Dave Cramer
>>
>> dave.cramer(at)credativ(dot)ca
>> http://www.credativ.ca
>>
>> On 6 June 2015 at 12:34, Robert DiFalco <robert.difalco@gmail.com> wrote:
>>
>>> Say I need to insert 250 rows. Is single-statement multiple row insert
>>> or JDBC batch likely to be faster?
>>>
>>> Thanks!
>>>
>>> R.
>>>
>>
>>
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Multiple Row Insert vs. Batch
@ 2015-06-06 19:07 Robert DiFalco <robert.difalco@gmail.com>
parent: Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 11+ messages in thread
From: Robert DiFalco @ 2015-06-06 19:07 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: Vitalii Tymchyshyn <vit@tym.im>; pgsql-jdbc
Yes that's correct. A multiple row insert with a single insert statement. I'll try benchmarking the two on Monday. My guess is that they are pretty damn similar.
Sent from my iPhone
> On Jun 6, 2015, at 10:35 AM, Dave Cramer <pg@fastcrypt.com> wrote:
>
> Robert ??
>
> Is that what you meant ?
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
>> On 6 June 2015 at 13:34, Vitalii Tymchyshyn <vit@tym.im> wrote:
>> I think OP meant something like
>> Insert into table values (?,?,?),(?,?,?),...,(?,?,?);
>> Vs batch of insert into table values(?,?,?);
>>
>> I really think first would be faster up to a certain amount of rows, but test is needed to check.
>>
>> Vitalii Tymchyshyn
>>
>> Сб, 6 черв. 2015 13:30 Dave Cramer <pg@fastcrypt.com> пише:
>>
>>> batch should be faster and if it isn't we did something wrong
>>>
>>> Dave Cramer
>>>
>>> dave.cramer(at)credativ(dot)ca
>>> http://www.credativ.ca
>>>
>>>> On 6 June 2015 at 12:34, Robert DiFalco <robert.difalco@gmail.com> wrote:
>>>> Say I need to insert 250 rows. Is single-statement multiple row insert or JDBC batch likely to be faster?
>>>>
>>>> Thanks!
>>>>
>>>> R.
>
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Multiple Row Insert vs. Batch
@ 2015-06-07 16:41 Robert DiFalco <robert.difalco@gmail.com>
parent: Robert DiFalco <robert.difalco@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: Robert DiFalco @ 2015-06-07 16:41 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: Vitalii Tymchyshyn <vit@tym.im>; pgsql-jdbc
I did a benchmark and multi-row insert with a single statement is about
6-7% faster than batch insert. This is for 250 rows executed a thousand
times in a loop (alternating between the two to reduce subsequent table
insert index slowdown). So a little faster but not significantly so.
On Sat, Jun 6, 2015 at 12:07 PM, Robert DiFalco <robert.difalco@gmail.com>
wrote:
> Yes that's correct. A multiple row insert with a single insert statement.
> I'll try benchmarking the two on Monday. My guess is that they are pretty
> damn similar.
>
> Sent from my iPhone
>
> On Jun 6, 2015, at 10:35 AM, Dave Cramer <pg@fastcrypt.com> wrote:
>
> Robert ??
>
> Is that what you meant ?
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
> On 6 June 2015 at 13:34, Vitalii Tymchyshyn <vit@tym.im> wrote:
>
>> I think OP meant something like
>> Insert into table values (?,?,?),(?,?,?),...,(?,?,?);
>> Vs batch of insert into table values(?,?,?);
>>
>> I really think first would be faster up to a certain amount of rows, but
>> test is needed to check.
>>
>> Vitalii Tymchyshyn
>>
>> Сб, 6 черв. 2015 13:30 Dave Cramer <pg@fastcrypt.com> пише:
>>
>> batch should be faster and if it isn't we did something wrong
>>>
>>> Dave Cramer
>>>
>>> dave.cramer(at)credativ(dot)ca
>>> http://www.credativ.ca
>>>
>>> On 6 June 2015 at 12:34, Robert DiFalco <robert.difalco@gmail.com>
>>> wrote:
>>>
>>>> Say I need to insert 250 rows. Is single-statement multiple row insert
>>>> or JDBC batch likely to be faster?
>>>>
>>>> Thanks!
>>>>
>>>> R.
>>>>
>>>
>>>
>
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Multiple Row Insert vs. Batch
@ 2015-06-07 16:56 Robert DiFalco <robert.difalco@gmail.com>
parent: Robert DiFalco <robert.difalco@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: Robert DiFalco @ 2015-06-07 16:56 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: Vitalii Tymchyshyn <vit@tym.im>; pgsql-jdbc
Another interesting thing is that for 250 records COPY is actually the
slowest. But these are real world tests to that could have been the time it
took to transform the 250 records to CSV.
On Sun, Jun 7, 2015 at 9:41 AM, Robert DiFalco <robert.difalco@gmail.com>
wrote:
> I did a benchmark and multi-row insert with a single statement is about
> 6-7% faster than batch insert. This is for 250 rows executed a thousand
> times in a loop (alternating between the two to reduce subsequent table
> insert index slowdown). So a little faster but not significantly so.
>
> On Sat, Jun 6, 2015 at 12:07 PM, Robert DiFalco <robert.difalco@gmail.com>
> wrote:
>
>> Yes that's correct. A multiple row insert with a single insert statement.
>> I'll try benchmarking the two on Monday. My guess is that they are pretty
>> damn similar.
>>
>> Sent from my iPhone
>>
>> On Jun 6, 2015, at 10:35 AM, Dave Cramer <pg@fastcrypt.com> wrote:
>>
>> Robert ??
>>
>> Is that what you meant ?
>>
>> Dave Cramer
>>
>> dave.cramer(at)credativ(dot)ca
>> http://www.credativ.ca
>>
>> On 6 June 2015 at 13:34, Vitalii Tymchyshyn <vit@tym.im> wrote:
>>
>>> I think OP meant something like
>>> Insert into table values (?,?,?),(?,?,?),...,(?,?,?);
>>> Vs batch of insert into table values(?,?,?);
>>>
>>> I really think first would be faster up to a certain amount of rows, but
>>> test is needed to check.
>>>
>>> Vitalii Tymchyshyn
>>>
>>> Сб, 6 черв. 2015 13:30 Dave Cramer <pg@fastcrypt.com> пише:
>>>
>>> batch should be faster and if it isn't we did something wrong
>>>>
>>>> Dave Cramer
>>>>
>>>> dave.cramer(at)credativ(dot)ca
>>>> http://www.credativ.ca
>>>>
>>>> On 6 June 2015 at 12:34, Robert DiFalco <robert.difalco@gmail.com>
>>>> wrote:
>>>>
>>>>> Say I need to insert 250 rows. Is single-statement multiple row insert
>>>>> or JDBC batch likely to be faster?
>>>>>
>>>>> Thanks!
>>>>>
>>>>> R.
>>>>>
>>>>
>>>>
>>
>
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Multiple Row Insert vs. Batch
@ 2015-06-08 09:27 jaime soler <jaime.soler@gmail.com>
parent: Robert DiFalco <robert.difalco@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: jaime soler @ 2015-06-08 09:27 UTC (permalink / raw)
To: Robert DiFalco <robert.difalco@gmail.com>; +Cc: Dave Cramer <pg@fastcrypt.com>; Vitalii Tymchyshyn <vit@tym.im>; pgsql-jdbc
El dom, 07-06-2015 a las 09:56 -0700, Robert DiFalco escribió:
> Another interesting thing is that for 250 records COPY is actually the
> slowest. But these are real world tests to that could have been the
> time it took to transform the 250 records to CSV.
Hi Robert,
Copy using
CopyManager( https://jdbc.postgresql.org/documentation/publicapi/org/postgresql/copy/CopyManager.html ) should be faster than multi-row inserts and batch single-row insert. Did you count only the copy time without transformation time ?
>
> On Sun, Jun 7, 2015 at 9:41 AM, Robert DiFalco
> <robert.difalco@gmail.com> wrote:
> I did a benchmark and multi-row insert with a single statement
> is about 6-7% faster than batch insert. This is for 250 rows
> executed a thousand times in a loop (alternating between the
> two to reduce subsequent table insert index slowdown). So a
> little faster but not significantly so.
>
> On Sat, Jun 6, 2015 at 12:07 PM, Robert DiFalco
> <robert.difalco@gmail.com> wrote:
> Yes that's correct. A multiple row insert with a
> single insert statement. I'll try benchmarking the two
> on Monday. My guess is that they are pretty damn
> similar.
>
> Sent from my iPhone
>
> On Jun 6, 2015, at 10:35 AM, Dave Cramer
> <pg@fastcrypt.com> wrote:
>
>
> > Robert ??
> >
> >
> > Is that what you meant ?
> >
> > Dave Cramer
> >
> > dave.cramer(at)credativ(dot)ca
> > http://www.credativ.ca
> >
> >
> > On 6 June 2015 at 13:34, Vitalii Tymchyshyn
> > <vit@tym.im> wrote:
> > I think OP meant something like
> > Insert into table values
> > (?,?,?),(?,?,?),...,(?,?,?);
> > Vs batch of insert into table values(?,?,?);
> >
> > I really think first would be faster up to a
> > certain amount of rows, but test is needed
> > to check.
> >
> > Vitalii Tymchyshyn
> >
> >
> >
> > Сб, 6 черв. 2015 13:30 Dave Cramer
> > <pg@fastcrypt.com> пише:
> >
> > batch should be faster and if it
> > isn't we did something wrong
> >
> > Dave Cramer
> >
> > dave.cramer(at)credativ(dot)ca
> > http://www.credativ.ca
> >
> >
> > On 6 June 2015 at 12:34, Robert
> > DiFalco <robert.difalco@gmail.com>
> > wrote:
> > Say I need to insert 250
> > rows. Is single-statement
> > multiple row insert or JDBC
> > batch likely to be faster?
> >
> >
> > Thanks!
> >
> >
> > R.
> >
> >
> >
> >
>
>
>
>
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Multiple Row Insert vs. Batch
@ 2015-06-08 16:29 Robert DiFalco <robert.difalco@gmail.com>
parent: jaime soler <jaime.soler@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: Robert DiFalco @ 2015-06-08 16:29 UTC (permalink / raw)
To: jaime.soler@gmail.com; +Cc: Dave Cramer <pg@fastcrypt.com>; Vitalii Tymchyshyn <vit@tym.im>; pgsql-jdbc
To make it apples to apples I included the time to transform the payload.
It's maybe 1-4% faster for 250 rows with 3 fields sampled 100 times with a
JVM warm-up.
On Mon, Jun 8, 2015 at 2:27 AM, jaime soler <jaime.soler@gmail.com> wrote:
> El dom, 07-06-2015 a las 09:56 -0700, Robert DiFalco escribió:
> > Another interesting thing is that for 250 records COPY is actually the
> > slowest. But these are real world tests to that could have been the
> > time it took to transform the 250 records to CSV.
> Hi Robert,
>
> Copy using
> CopyManager(
> https://jdbc.postgresql.org/documentation/publicapi/org/postgresql/copy/CopyManager.html
> ) should be faster than multi-row inserts and batch single-row insert. Did
> you count only the copy time without transformation time ?
> >
> > On Sun, Jun 7, 2015 at 9:41 AM, Robert DiFalco
> > <robert.difalco@gmail.com> wrote:
> > I did a benchmark and multi-row insert with a single statement
> > is about 6-7% faster than batch insert. This is for 250 rows
> > executed a thousand times in a loop (alternating between the
> > two to reduce subsequent table insert index slowdown). So a
> > little faster but not significantly so.
> >
> > On Sat, Jun 6, 2015 at 12:07 PM, Robert DiFalco
> > <robert.difalco@gmail.com> wrote:
> > Yes that's correct. A multiple row insert with a
> > single insert statement. I'll try benchmarking the two
> > on Monday. My guess is that they are pretty damn
> > similar.
> >
> > Sent from my iPhone
> >
> > On Jun 6, 2015, at 10:35 AM, Dave Cramer
> > <pg@fastcrypt.com> wrote:
> >
> >
> > > Robert ??
> > >
> > >
> > > Is that what you meant ?
> > >
> > > Dave Cramer
> > >
> > > dave.cramer(at)credativ(dot)ca
> > > http://www.credativ.ca
> > >
> > >
> > > On 6 June 2015 at 13:34, Vitalii Tymchyshyn
> > > <vit@tym.im> wrote:
> > > I think OP meant something like
> > > Insert into table values
> > > (?,?,?),(?,?,?),...,(?,?,?);
> > > Vs batch of insert into table values(?,?,?);
> > >
> > > I really think first would be faster up to a
> > > certain amount of rows, but test is needed
> > > to check.
> > >
> > > Vitalii Tymchyshyn
> > >
> > >
> > >
> > > Сб, 6 черв. 2015 13:30 Dave Cramer
> > > <pg@fastcrypt.com> пише:
> > >
> > > batch should be faster and if it
> > > isn't we did something wrong
> > >
> > > Dave Cramer
> > >
> > > dave.cramer(at)credativ(dot)ca
> > > http://www.credativ.ca
> > >
> > >
> > > On 6 June 2015 at 12:34, Robert
> > > DiFalco <robert.difalco@gmail.com>
> > > wrote:
> > > Say I need to insert 250
> > > rows. Is single-statement
> > > multiple row insert or JDBC
> > > batch likely to be faster?
> > >
> > >
> > > Thanks!
> > >
> > >
> > > R.
> > >
> > >
> > >
> > >
> >
> >
> >
> >
>
>
>
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Multiple Row Insert vs. Batch
@ 2015-06-08 17:14 Álvaro Hernández Tortosa <aht@8Kdata.com>
parent: Robert DiFalco <robert.difalco@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: Álvaro Hernández Tortosa @ 2015-06-08 17:14 UTC (permalink / raw)
To: Robert DiFalco <robert.difalco@gmail.com>; jaime.soler@gmail.com; +Cc: Dave Cramer <pg@fastcrypt.com>; Vitalii Tymchyshyn <vit@tym.im>; pgsql-jdbc
Hi Robert.
That sounds interesting. Is your test code published / publishable,
for peer review? Are you using jmh or any similar tool for conducting
the test? Have you considering throwing latency measures into the test
(where hdrhistogram may be a great helper).
Sorry for asking too many questions, but I hope they help :)
Regards,
--
Álvaro Hernández Tortosa
-----------
8Kdata
On 08/06/15 12:29, Robert DiFalco wrote:
> To make it apples to apples I included the time to transform the
> payload. It's maybe 1-4% faster for 250 rows with 3 fields sampled 100
> times with a JVM warm-up.
>
> On Mon, Jun 8, 2015 at 2:27 AM, jaime soler <jaime.soler@gmail.com
> <mailto:jaime.soler@gmail.com>> wrote:
>
> El dom, 07-06-2015 a las 09:56 -0700, Robert DiFalco escribió:
> > Another interesting thing is that for 250 records COPY is
> actually the
> > slowest. But these are real world tests to that could have been the
> > time it took to transform the 250 records to CSV.
> Hi Robert,
>
> Copy using
> CopyManager(
> https://jdbc.postgresql.org/documentation/publicapi/org/postgresql/copy/CopyManager.html
> ) should be faster than multi-row inserts and batch single-row
> insert. Did you count only the copy time without transformation time ?
> >
> > On Sun, Jun 7, 2015 at 9:41 AM, Robert DiFalco
> > <robert.difalco@gmail.com <mailto:robert.difalco@gmail.com>> wrote:
> > I did a benchmark and multi-row insert with a single
> statement
> > is about 6-7% faster than batch insert. This is for 250 rows
> > executed a thousand times in a loop (alternating between the
> > two to reduce subsequent table insert index slowdown). So a
> > little faster but not significantly so.
> >
> > On Sat, Jun 6, 2015 at 12:07 PM, Robert DiFalco
> > <robert.difalco@gmail.com
> <mailto:robert.difalco@gmail.com>> wrote:
> > Yes that's correct. A multiple row insert with a
> > single insert statement. I'll try benchmarking
> the two
> > on Monday. My guess is that they are pretty damn
> > similar.
> >
> > Sent from my iPhone
> >
> > On Jun 6, 2015, at 10:35 AM, Dave Cramer
> > <pg@fastcrypt.com <mailto:pg@fastcrypt.com>> wrote:
> >
> >
> > > Robert ??
> > >
> > >
> > > Is that what you meant ?
> > >
> > > Dave Cramer
> > >
> > > dave.cramer(at)credativ(dot)ca
> > > http://www.credativ.ca
> > >
> > >
> > > On 6 June 2015 at 13:34, Vitalii Tymchyshyn
> > > <vit@tym.im <mailto:vit@tym.im>> wrote:
> > > I think OP meant something like
> > > Insert into table values
> > > (?,?,?),(?,?,?),...,(?,?,?);
> > > Vs batch of insert into table
> values(?,?,?);
> > >
> > > I really think first would be faster
> up to a
> > > certain amount of rows, but test is needed
> > > to check.
> > >
> > > Vitalii Tymchyshyn
> > >
> > >
> > >
> > > Сб, 6 черв. 2015 13:30 Dave Cramer
> > > <pg@fastcrypt.com
> <mailto:pg@fastcrypt.com>> пише:
> > >
> > > batch should be faster and if it
> > > isn't we did something wrong
> > >
> > > Dave Cramer
> > >
> > > dave.cramer(at)credativ(dot)ca
> > > http://www.credativ.ca
> > >
> > >
> > > On 6 June 2015 at 12:34, Robert
> > > DiFalco
> <robert.difalco@gmail.com <mailto:robert.difalco@gmail.com>>
> > > wrote:
> > > Say I need to insert 250
> > > rows. Is single-statement
> > > multiple row insert or JDBC
> > > batch likely to be faster?
> > >
> > >
> > > Thanks!
> > >
> > >
> > > R.
> > >
> > >
> > >
> > >
> >
> >
> >
> >
>
>
>
--
Álvaro Hernández Tortosa
-----------
8Kdata
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Multiple Row Insert vs. Batch
@ 2015-06-08 18:04 Robert DiFalco <robert.difalco@gmail.com>
parent: Álvaro Hernández Tortosa <aht@8Kdata.com>
0 siblings, 0 replies; 11+ messages in thread
From: Robert DiFalco @ 2015-06-08 18:04 UTC (permalink / raw)
To: Álvaro Hernández Tortosa <aht@8kdata.com>; +Cc: Jaime Soler <jaime.soler@gmail.com>; Dave Cramer <pg@fastcrypt.com>; Vitalii Tymchyshyn <vit@tym.im>; pgsql-jdbc
Sorry, the code is not available, yes JMH. :( I may be able to do that at
some point. One thing to note. I am using "SET LOCAL synchronous_commit TO
OFF" on the session for these inserts. For the single statement/multi-row
version I am able to have one round trip because I can send this command +
';' + the multi-row insert. For CopyManager I need to create a separate
statement and execute it on its own (so an extra round-trip).
On Mon, Jun 8, 2015 at 10:14 AM, Álvaro Hernández Tortosa <aht@8kdata.com>
wrote:
>
> Hi Robert.
>
> That sounds interesting. Is your test code published / publishable,
> for peer review? Are you using jmh or any similar tool for conducting the
> test? Have you considering throwing latency measures into the test (where
> hdrhistogram may be a great helper).
>
> Sorry for asking too many questions, but I hope they help :)
>
> Regards,
>
>
>
> --
> Álvaro Hernández Tortosa
>
>
> -----------
> 8Kdata
>
>
> On 08/06/15 12:29, Robert DiFalco wrote:
>
> To make it apples to apples I included the time to transform the payload.
> It's maybe 1-4% faster for 250 rows with 3 fields sampled 100 times with a
> JVM warm-up.
>
> On Mon, Jun 8, 2015 at 2:27 AM, jaime soler <jaime.soler@gmail.com> wrote:
>
>> El dom, 07-06-2015 a las 09:56 -0700, Robert DiFalco escribió:
>> > Another interesting thing is that for 250 records COPY is actually the
>> > slowest. But these are real world tests to that could have been the
>> > time it took to transform the 250 records to CSV.
>> Hi Robert,
>>
>> Copy using
>> CopyManager(
>> https://jdbc.postgresql.org/documentation/publicapi/org/postgresql/copy/CopyManager.html
>> ) should be faster than multi-row inserts and batch single-row insert. Did
>> you count only the copy time without transformation time ?
>> >
>> > On Sun, Jun 7, 2015 at 9:41 AM, Robert DiFalco
>> > <robert.difalco@gmail.com> wrote:
>> > I did a benchmark and multi-row insert with a single statement
>> > is about 6-7% faster than batch insert. This is for 250 rows
>> > executed a thousand times in a loop (alternating between the
>> > two to reduce subsequent table insert index slowdown). So a
>> > little faster but not significantly so.
>> >
>> > On Sat, Jun 6, 2015 at 12:07 PM, Robert DiFalco
>> > <robert.difalco@gmail.com> wrote:
>> > Yes that's correct. A multiple row insert with a
>> > single insert statement. I'll try benchmarking the two
>> > on Monday. My guess is that they are pretty damn
>> > similar.
>> >
>> > Sent from my iPhone
>> >
>> > On Jun 6, 2015, at 10:35 AM, Dave Cramer
>> > <pg@fastcrypt.com> wrote:
>> >
>> >
>> > > Robert ??
>> > >
>> > >
>> > > Is that what you meant ?
>> > >
>> > > Dave Cramer
>> > >
>> > > dave.cramer(at)credativ(dot)ca
>> > > http://www.credativ.ca
>> > >
>> > >
>> > > On 6 June 2015 at 13:34, Vitalii Tymchyshyn
>> > > <vit@tym.im> wrote:
>> > > I think OP meant something like
>> > > Insert into table values
>> > > (?,?,?),(?,?,?),...,(?,?,?);
>> > > Vs batch of insert into table values(?,?,?);
>> > >
>> > > I really think first would be faster up to a
>> > > certain amount of rows, but test is needed
>> > > to check.
>> > >
>> > > Vitalii Tymchyshyn
>> > >
>> > >
>> > >
>> > > Сб, 6 черв. 2015 13:30 Dave Cramer
>> > > <pg@fastcrypt.com> пише:
>> > >
>> > > batch should be faster and if it
>> > > isn't we did something wrong
>> > >
>> > > Dave Cramer
>> > >
>> > > dave.cramer(at)credativ(dot)ca
>> > > http://www.credativ.ca
>> > >
>> > >
>> > > On 6 June 2015 at 12:34, Robert
>> > > DiFalco <robert.difalco@gmail.com>
>> > > wrote:
>> > > Say I need to insert 250
>> > > rows. Is single-statement
>> > > multiple row insert or JDBC
>> > > batch likely to be faster?
>> > >
>> > >
>> > > Thanks!
>> > >
>> > >
>> > > R.
>> > >
>> > >
>> > >
>> > >
>> >
>> >
>> >
>> >
>>
>>
>>
>
> --
> Álvaro Hernández Tortosa
>
>
> -----------
> 8Kdata
>
>
>
^ permalink raw reply [nested|flat] 11+ messages in thread
end of thread, other threads:[~2015-06-08 18:04 UTC | newest]
Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-06-06 16:34 Multiple Row Insert vs. Batch Robert DiFalco <robert.difalco@gmail.com>
2015-06-06 17:29 ` Dave Cramer <pg@fastcrypt.com>
2015-06-06 17:34 ` Vitalii Tymchyshyn <vit@tym.im>
2015-06-06 17:35 ` Dave Cramer <pg@fastcrypt.com>
2015-06-06 19:07 ` Robert DiFalco <robert.difalco@gmail.com>
2015-06-07 16:41 ` Robert DiFalco <robert.difalco@gmail.com>
2015-06-07 16:56 ` Robert DiFalco <robert.difalco@gmail.com>
2015-06-08 09:27 ` jaime soler <jaime.soler@gmail.com>
2015-06-08 16:29 ` Robert DiFalco <robert.difalco@gmail.com>
2015-06-08 17:14 ` Álvaro Hernández Tortosa <aht@8Kdata.com>
2015-06-08 18:04 ` Robert DiFalco <robert.difalco@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox