I think, the case is not about inserting bulk data from one table to another.
For example, we can buffer minion jobs via enqueue and insert them to minion_jobs all at once in the end of request. That feature also is very valuable for highload project if you want to store some kind of logs in the database. So bulk inserts is definitely a good thing and I use them a lot in my daily job. PS: by the way, PostgreSQL supports bulk updates... Maybe, it should be in a feature list too. суббота, 3 февраля 2018 г., 9:40:55 UTC+3 пользователь Abel Abraham Camarillo Ojeda написал: > > On Fri, Feb 2, 2018 at 10:16 PM, Stefan Adams <s103...@gmail.com > <javascript:>> wrote: > > > > > > On Thu, Feb 1, 2018 at 6:42 AM, Sebastian Riedel <kra...@gmail.com > <javascript:>> 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...@googlegroups.com <javascript:>. > > To post to this group, send email to mojol...@googlegroups.com > <javascript:>. > > 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.