I got the bottom of this myself, and the answer is, no, as of 5.0, Django can not execute database queries concurrently.
- Psycopg 2 has no async support at all.
- Psycopg 3 does, but that is not integrated with Django.
- Most if not all
async def a...
ORM queries are just wrappers aroundsync_to_async
: https://github.com/django/django/blob/main/django/db/models/query.py#L658-L659 - What
sync_to_async
does is running functions on a separate thread, one after another.
Now I understand that implementing a truly asynchronous database backend is a huge undertaking. The only thing I found is this work in progress pull request, but it seems to be in a very early stage: Support async database backends by domingues · Pull Request #17275 · django/django · GitHub