Hey! Is there any comparison in terms of performan...
# orm-help
c
Hey! Is there any comparison in terms of performance between Prisma with mongo or Prisma with postgres or mysql? Or any recommendations what type of projects are better for one or the other?
s
Prisma isn’t really your deciding factor in this case, its the DBs themselves. Check out some articles that compare NoSQL to SQL DBs and the pros/cons of each.
👍 1
c
Yes and i'd recon that the same pro's & cons apply when Prisma is added to stack.
In the mongodb release post the prisma team says this:
Copy code
While this approach enables querying for Post documents directly in the Prisma API (as opposed to embedded types which can only be queried through nested operations via their parent types), there are performance considerations when modeling relations this way.

Operations that go from a Post to a User via the author field will be more expensive. This is because the underlying Post objects don't know who their authors are and Prisma needs to filter all Users to find who the author of Post is.
s
Indeed, this is a normal way of doing “relations” in a NoSQL DB.
c
Exactly 🙂 But since the datamodel and api of prisma is exactly the same regardless of which database we use, i'm just wondering if there are any recommendations regarding the type of application with a specific database
s
Either you embed, or reference. Embedding is fast… very fast. But if the data you’re embedding is write-heavy, there’s a huge perf. penalty there. Conversely, if you reference, there’s a read penalty every time.
As I said, the “type” of app that’s best suited for each isn’t really a Prisma issue, it’s whether your app is highly relational in nature. Whether it’s read or write heavy. The format of the data you’re storing.
c
I'm not saying it's a prisma issue 🙂
Maybe i should have stated my question differently. My question is since prisma has a mongodb connector now (which is great 🙂 ), can someone point me to some good articles that highlight the differences between postgres/mysql and mongodb?
c
Thanks @siyfion!
l
My simplistic way of deciding is will I query my data bidirectionally. That is, my posts have comments. But will I query comments that have posts? If so, I choose relational. Otherwise it’s good to get the embedded efficiencies from NoSQL (comments embedded in posts)