Shih-Min Lee's Personal website

dating, chating, food, games, search

Follow me on GitHub

😀 PostgreSql jsonb

So apparently starting from postgres 9.4 there’s a new type called jsonb which supports json like field properties. And you can search what is inside the json. It’s pretty sweet.

According to a stackoverflow post:

  • json stores JSON documents as text, performing validation when the documents are stored, and parsing them on output if needed (i.e. accessing individual fields); it should support the entire JSON spec. Since the entire JSON text is stored, its formatting is preserved.

  • jsonb takes shortcuts for performance reasons: JSON data is parsed on input and stored in binary format, key orderings in dictionaries are not maintained, and neither are duplicate keys. Accessing individual elements in the JSONB field is fast as it doesn’t require parsing the JSON text all the time. On output, JSON data is reconstructed and initial formatting is lost.

–

references:

10 May 2016