Re: patch: Add JSON datatype to PostgreSQL (GSoC, WIP) - Mailing list pgsql-hackers

From Terry Laurenzo
Subject Re: patch: Add JSON datatype to PostgreSQL (GSoC, WIP)
Date
Msg-id AANLkTiknwbEFW-gFyndRfCXsYoyq8pRm=NKwHecQRyJw@mail.gmail.com
Whole thread Raw
In response to Re: patch: Add JSON datatype to PostgreSQL (GSoC, WIP)  (Itagaki Takahiro <itagaki.takahiro@gmail.com>)
Responses Re: patch: Add JSON datatype to PostgreSQL (GSoC, WIP)
List pgsql-hackers
Good points.  In addition, any binary format needs to support object property traversal without having to do a deep
scanof all descendants.  BSON handles this with explicit lengths for document types (objects and arrays) so that entire
partsof the tree can be skipped during sibling traversal.<br /><br />It would also be nice to make sure that we store
fullyparsed strings.  There are lots of escape options that simply do not need to be preserved (c escapes, unicode,
octal,hex sequences) and hinder the ability to do direct comparisons.  BSON also makes a small extra effort to ensure
thatobject property names are encoded in a way that is easily comparable, as this will be the most frequently compared
items.<br/><br />I'm still going to write up a proposed grammar that takes these items into account - just ran out of
timetonight.<br /><br />Terry<br /><br /><div class="gmail_quote">On Wed, Oct 20, 2010 at 12:46 AM, Itagaki Takahiro
<spandir="ltr"><<a href="mailto:itagaki.takahiro@gmail.com">itagaki.takahiro@gmail.com</a>></span> wrote:<br
/><blockquoteclass="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex;
padding-left:1ex;"><div class="im">On Wed, Oct 20, 2010 at 6:39 AM, Terry Laurenzo <<a
href="mailto:tj@laurenzo.org">tj@laurenzo.org</a>>wrote:<br /> > The answer may be to have both a jsontext and
jsonbinarytype as each will<br /> > be optimized for a different case.<br /><br /></div>I want to choose one format
forJSON rather than having two types.<br /> It should be more efficient than other format in many cases,<br /> and not
sobad in other cases.<br /><br /> I think the discussion was started with<br />  "BSON could represent was a subset of
whatJSON could represent".<br /> So, any binary format could be acceptable that have enough<br /> representational
powercompared with text format.<br /><br /> For example, a sequence of <byte-length> <text> could reduce<br
/>CPU cycles for reparsing and hold all of the input as-is except<br /> ignorable white-spaces. It is not a BSON, but
isa binary format.<br /><br /> Or, if we want to store numbers in binary form, I think the<br /> format will be numeric
typein postgres. It has high precision,<br /> and we don't need any higher precision than it to compare two<br />
numberseventually. Even if we use BSON format, we need to extend<br /> it to store all of numeric values, that
precisionis 10^1000.<br /><br /> --<br /><font color="#888888">Itagaki Takahiro<br /></font></blockquote></div><br /> 

pgsql-hackers by date:

Previous
From: Itagaki Takahiro
Date:
Subject: Re: patch: Add JSON datatype to PostgreSQL (GSoC, WIP)
Next
From: Dimitri Fontaine
Date:
Subject: Re: Extensions, this time with a patch