It works with MySQL, it doesn't with PostgreSQL. PostgreSQL has options for asynchronous queries, but it's clear than even the person who made them has never actually used them!
Take a look at the docs for pg_send_query: "multiple queries cannot be sent over a busy connection. If a query is sent while the connection is busy, it waits until the last query is finished and discards all its results."
If you actually try, it will block on the next query! Who wrote this useless library?
There is also no callback or anything, you simply have to allow it to block in order to pick up results. (There is the undocumented pg_select which might work.) Queries must be sent and received in order, and one at a time. You can't run 2 at once (say a long running query, then a quick short one later in your code). You can't even send another one while the first is running (and block), because that causes the results from the first to be discarded.
Very disappointed with PostgreSQL because of this.
In contrast MySQL has mysqli_poll() which actually works like you'd expect.
If I had a job that needed asynchronous database queries, I'd definitely pick MySQL.