dbal icon indicating copy to clipboard operation
dbal copied to clipboard

[Feature request] Running parallel/async doctrine queries

Open nacholibre opened this issue 2 years ago • 1 comments

Feature Request

Q A
New Feature yes
RFC yes

Summary

First of all, thanks to all maintainers of Doctrine. You make the world better. 👏

It would be neat if doctrine can run multiple queries without waiting for each to finish after executing the next one. Currently I have a use case for a search page, which queries the database several times and the total time of all queries is relatively big, but each query by itself takes no more than 300ms. Getting around this is no trivial task. Only if I could run these queries in parallel. It seems that PHP 8.1 supports something like this with Fibers.

It there currently any limitation to implement parallelism in Doctrine? I'm sure that for most people this is must have feature and it would be very beneficial for the whole community.

nacholibre avatar Nov 30 '22 11:11 nacholibre

It there currently any limitation to implement parallelism in Doctrine?

Yes, the various database extensions of PHP. Most of them don't support multiple asynchronous queries over a single connection.

It seems that PHP 8.1 supports something like this with Fibers.

I haven't tested that yet, but it should be possible to open multiple database connections and use fibers to query them in parallel. But we don't need to change anything in DBAL to enable this, do we?

derrabus avatar Dec 12 '22 18:12 derrabus