use DBI; use POE; my $dbh = DBI->connect('dbi:mysql:****', '****', '****', {RaiseError => 1}); POE::Session->create(inline_states => {_start => \&tester}, heap => {dbh => $dbh->clone()}); POE::Session->create(inline_states => {_start => \&tester}, heap => {dbh => $dbh->clone()}); POE::Kernel->run(); sub tester { my $heap = $_[HEAP]; for my $key (@{$heap->{dbh}->selectcol_arrayref("SELECT id, sleep(0.1) FROM mytable WHERE 1")}) { print $key; } }