Created
June 24, 2019 15:32
-
-
Save renormalist/2074a397da997c4e0376417747f57ee1 to your computer and use it in GitHub Desktop.
Mojo::Pg - linear insert speed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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