What's interesting is that inserting to JSONB is slightly faster than inserting to JSON. Insert 10,000 rows to JSONB, execution time (sec): Insert 10,000 rows to JSON, execution time (sec):ĥ. Multi insert (10) to JSONB table, result: The second test (insert performance) results are as following (python script attached):ġ. The results of the first test (disk usage) are attached (excel sheet) - in it you can see a 26% overhead in JSONB over JSON. In my test db I created 2 tables, each has only one column named 'data', in each I store a JSON\B with 10 fields. So I wrote 2 small test in python one for storage and one for insert performance. I also wanted to experiment with disk usage. In my application insert time is more critical than read time, since I do not have many clients on the reading side, and time is not critical. Part of that is understanding insert times in JSON and JSONB. I wanted to make sure I don't run into a consumer-producer problem where my producer generates data at a rate the consumer cannot handle. My application has a data producer which sends data to a consumer which in turn inserts the data to the DB. However, queries are much faster for JSONB especially when using indexes.ĭisk Usage - JSONB uses more space vs JSON, I assume this is due to its meta data it stores in the binary.īut, I need to take my application use cases into consideration when making the decision of JSON vs JSONB: Performance - JSON is faster for inserts since it only odes JSON format verification, vs JSONB which also converts the jSON input to a binary JSONB with its meta-data. I am trying to decide whether to use JSON or JSONB to store my application data.įrom what I read so far about JSON vs JSONB:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |