Add Perl/PostgreSQL version

This commit is contained in:
Peter J. Holzer 2021-05-06 22:35:38 +02:00 committed by Peter J. Holzer
parent 2e3f11587e
commit 141f281b81
1 changed files with 24 additions and 0 deletions

24
dcb_perl_psql Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/perl
use v5.30;
use warnings;
use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
my $t0 = clock_gettime(CLOCK_MONOTONIC);
use DBI;
for my $rep (1 .. 2) {
my $t1 = clock_gettime(CLOCK_MONOTONIC);
my $dbh = DBI->connect("dbi:Pg:", "");
my $t2 = clock_gettime(CLOCK_MONOTONIC);
my $result = $dbh->selectall_arrayref("select current_timestamp");
my $t3 = clock_gettime(CLOCK_MONOTONIC);
$dbh->disconnect();
my $t4 = clock_gettime(CLOCK_MONOTONIC);
say $t2 - $t1, " connect $rep";
say $t4 - $t1, " session $rep";
}