0

I want to use JSONB but then I have read this:

JSON
The JSON data type works better than JSONB when:

You have to perform a lot of INSERT operations
You do not expect to perform complex queries on your JSON data
You need to preserve the original JSON data indentation and format

So in my case I have a lot of insert operations but also a lot of reads/updates.

So what to use now? It is an e-commerce application.

And has JSONB any drawbacks or it is not good for e-commerce structure?

Mustafa Özçetin
  • 1,893
  • 1
  • 14
  • 16
  • "Lots of inserts" refers to huge imports with millions of rows, where storing the text as it is received is simpler and more performant than parsing it into a better data structure. You do not have that. – Bergi May 24 '23 at 19:11
  • Does this answer your question? [JSON vs JSONB Postgresql](https://stackoverflow.com/questions/68820299/json-vs-jsonb-postgresql) – Bergi May 24 '23 at 19:14
  • "*I have read this*" - where? Please [edit] your question to add a link – Bergi May 24 '23 at 19:14
  • Please clarify what you mean with "lots of updates". Do you replace the whole JSON with a different JSON? – Laurenz Albe May 24 '23 at 19:35
  • "a lot" is not a number and it's unclear what kind of (virtual) hardware you're using. 1000 transactions per second used to be a lot for a single database, nowadays it's normal to this kind of performance. On AWS, Azure and other cloud environments you're just a few clicks away from much higher IOPS anyway. Besides this, you know your data, you can setup a test environment and test the different datatypes for your specific workload. – Frank Heikens May 25 '23 at 05:32
  • @FrankHeikens but which would you prefer ? I have also take care of MVCC – stackcall01 May 25 '23 at 12:47
  • My personal preference is jsonb, it matches my requirements slightly better then json. But that's just me, I don't know your requirements. – Frank Heikens May 25 '23 at 13:08

0 Answers0