On Thu, Feb 1, 2018 at 6:42 AM, Sebastian Riedel <[email protected]> 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);
}
FWIW, I ran a quick benchmark
<https://gist.github.com/s1037989/2caa12379b733c7467c634e83f3331a7> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.