On Fri, Feb 2, 2018 at 10:16 PM, Stefan Adams <s1037...@gmail.com> wrote:
>
>
> On Thu, Feb 1, 2018 at 6:42 AM, Sebastian Riedel <kra...@gmail.com> wrote:
>>
>> > I spoke with you about this briefly on Twitter, but just figured I'd put
>> > it
>> > out here, too.  What about multiple record inserts on a single call?
>> > Twitter thread.
>>
>> Yes, it's possible, not sure about how useful it would actually be though.
>
>
> This makes sense!  I'm able to do this below, which is all that I really
> need:
>
>   my $i = $pg->db->dbh->prepare('insert into b (first, last, birthday, age,
> phone) values(?, ?, ?, ?, ?)');
>
>   my $results = $pg->db->select('a', [qw/first last birthday age phone/],
> undef, {limit => $limit, offset => 1});
>
>   while ( my $next = $results->array ) {
>
>     $i->execute(@$next);
>
>   }
>

in postgres you should be able, in case of inserting from one table to other:

insert into b (first, last, birthday, age, phone) select first, last,
..., phone from a;

and you save the whole round-trip of data.

> FWIW, I ran a quick benchmark on 3 different algorithms to insert bulk data
> into a database, and the method above was the fastest by far.  Is there a
> better / faster algorithm still to use for inserting bulk data?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mojolicious+unsubscr...@googlegroups.com.
> To post to this group, send email to mojolicious@googlegroups.com.
> Visit this group at https://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to