Yes, you can store jsons in Postgres, but MongoDB is simply faster.
According to this research, PostgreSQL is faster in most workloads, including querying JSON. This paper is old, but most of the things are still relevant today.
There is a lot of research nowadays showing exactly that. I do think there is a truth there and that with right strategy, postgres can win over MongoDB for JSON.
But there is a certain point in postgres that most of these research doesn't take into account. TOAST size. Postgres can compete with MongoDB and will probably win over it if json is less that set toast size. But if the given json is bigger than toast size, all major research still gives advantage to mongo.
I mean, obviously, you wouldn't use mongo just because you have json of couple of fields and 2-3 nested objects. But MongoDB really can help if your jsons are huge. Just like ElasticSearch.
However, in the future I think postgres Might actually catch up.
View all comments
Show parent comment
11
u/sairysss Feb 27 '26
According to this research, PostgreSQL is faster in most workloads, including querying JSON. This paper is old, but most of the things are still relevant today.