Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mojo::Pg - linear insert speed
#! /usr/bin/env perl
# Mojolicious 8.17
# PostgreSQL 9.5.14
use 5.022;
use Mojo::Pg;
use Benchmark ':all';
my $id;
my $pg = Mojo::Pg->new('postgresql://'.$ENV{USER}.'@/tapdomdb_test');
my $db = $pg->db;
timethis(10_000, sub {
$id = $db->insert('tap_dom',
{uuid => '5c437cb4-e326-4dde-960d-b575e78663b0'},
{returning => 'tap_dom_id'}
)->hash->{tap_dom_id};
});
say "Last inserted id: $id";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.