NAME

DBIO::PostgreSQL::Async - Async PostgreSQL storage for DBIO via EV::Pg

VERSION

version 0.900000

SYNOPSIS

# Schema setup
my $schema = MyApp::Schema->connect(
    'DBIO::PostgreSQL::Async',
    {
        host      => 'localhost',
        dbname    => 'myapp',
        user      => 'myapp',
        pool_size => 10,
    },
);

# Async queries return Futures
$schema->resultset('Artist')->all_async->then(sub {
    my @artists = @_;
    say $_->name for @artists;
});

# Pipeline mode — batch queries in one round-trip
$schema->storage->pipeline(sub {
    my @futures;
    push @futures, $schema->resultset('Artist')
        ->create_async({ name => $_ }) for @names;
    return Future->needs_all(@futures);
});

# LISTEN/NOTIFY
$schema->storage->listen('changelog', sub {
    my ($channel, $payload) = @_;
    say "Event: $payload";
});

# Sync methods still work (block the event loop)
my @all = $schema->resultset('Artist')->all;

DESCRIPTION

Async PostgreSQL support for DBIO using EV::Pg, a non-blocking PostgreSQL client built on libpq's async protocol. Bypasses DBI entirely for maximum performance.

Supports pipeline mode (batching queries in a single round-trip), prepared statements, COPY, and LISTEN/NOTIFY.

EVENT LOOP COMPATIBILITY

EV::Pg uses the EV event loop. This works with:

AUTHOR

DBIO Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.