prisma nested fields
is it okay in terms of performance to have many nested fields in prisma?
3 Replies
Hi @Emi 👋
Having to include many nested fields in your queries can have performance implications. Each level of
include
results in an additional SQL query. For example, if you have a user
model that includes licenses
, which in turn includes subscription
, which includes organization
, which includes admin
, this would result in multiple SQL queries.
The more nested your include statements are, the more SQL queries will be generated, which could potentially impact performance.
There are open issues with respect to this here and here.
Also you should note that we recently released the relationJoins
preview feature which aims to improve the performance of nested reads as stated hereGitHub
Network latency increases with selecting nested relations · Issue #...
Bug description Per #5043 (comment), I am making this issue. I have found that joins have worse performance as the client <-> database latency increases. How to reproduce Check out the typesc...
GitHub
Issues · prisma/prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB - Issues · prisma/prisma
GitHub
Release 5.7.0 · prisma/prisma
🌟 Help us spread the word about Prisma by starring the repo or posting on X (formerly Twitter) about the release.
Highlights
✨ In this release, we improved the SQL queries Prisma Client generates f...
thanks just what I needed!
You're welcome.