pgsql: Introduce jsonb, a structured format for storing json.
Introduce jsonb, a structured format for storing json.
The new format accepts exactly the same data as the json type. However, it is
stored in a format that does not require reparsing the orgiginal text in order
to process it, making it much more suitable for indexing and other operations.
Insignificant whitespace is discarded, and the order of object keys is not
preserved. Neither are duplicate object keys kept - the later value for a given
key is the only one stored.
The new type has all the functions and operators that the json type has,
with the exception of the json generation functions (to_json, json_agg etc.)
and with identical semantics. In addition, there are operator classes for
hash and btree indexing, and two classes for GIN indexing, that have no
equivalent in the json type.
This feature grew out of previous work by Oleg Bartunov and Teodor Sigaev, which
was intended to provide similar facilities to a nested hstore type, but which
in the end proved to have some significant compatibility issues.
Authors: Oleg Bartunov, Teodor Sigaev, Peter Geoghegan and Andrew Dunstan.
Review: Andres Freund
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/d9134d0a355cfa447adc80db4505d5931084278a
Modified Files
--------------
contrib/hstore/Makefile | 3 +-
contrib/hstore/expected/hstore.out | 20 +-
contrib/hstore/hstore--1.2--1.3.sql | 17 +
contrib/hstore/hstore--1.2.sql | 537 --------
contrib/hstore/hstore--1.3.sql | 550 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/hstore/hstore_io.c | 165 +++
contrib/hstore/sql/hstore.sql | 6 +-
doc/src/sgml/datatype.sgml | 37 +-
doc/src/sgml/filelist.sgml | 1 +
doc/src/sgml/func.sgml | 500 +++++---
doc/src/sgml/json.sgml | 413 ++++++
src/backend/catalog/system_views.sql | 8 +
src/backend/utils/adt/Makefile | 10 +-
src/backend/utils/adt/json.c | 42 +-
src/backend/utils/adt/jsonb.c | 468 +++++++
src/backend/utils/adt/jsonb_gin.c | 646 ++++++++++
src/backend/utils/adt/jsonb_op.c | 295 +++++
src/backend/utils/adt/jsonb_util.c | 1872 +++++++++++++++++++++++++++
src/backend/utils/adt/jsonfuncs.c | 1229 ++++++++++++++++--
src/backend/utils/adt/numeric.c | 38 +
src/include/catalog/pg_amop.h | 27 +
src/include/catalog/pg_amproc.h | 13 +-
src/include/catalog/pg_cast.h | 4 +
src/include/catalog/pg_opclass.h | 4 +
src/include/catalog/pg_operator.h | 37 +-
src/include/catalog/pg_opfamily.h | 5 +
src/include/catalog/pg_proc.h | 81 +-
src/include/catalog/pg_type.h | 6 +
src/include/funcapi.h | 9 +
src/include/utils/json.h | 15 +
src/include/utils/jsonapi.h | 8 +-
src/include/utils/jsonb.h | 320 +++++
src/include/utils/numeric.h | 1 +
src/test/regress/data/jsonb.data | 1009 +++++++++++++++
src/test/regress/expected/json.out | 49 +-
src/test/regress/expected/json_1.out | 49 +-
src/test/regress/expected/jsonb.out | 2056 ++++++++++++++++++++++++++++++
src/test/regress/expected/jsonb_1.out | 2056 ++++++++++++++++++++++++++++++
src/test/regress/expected/opr_sanity.out | 6 +-
src/test/regress/parallel_schedule | 3 +-
src/test/regress/serial_schedule | 1 +
src/test/regress/sql/json.sql | 18 +-
src/test/regress/sql/jsonb.sql | 479 +++++++
44 files changed, 12198 insertions(+), 917 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
On 23 March 2014 21:17, Andrew Dunstan <andrew@dunslane.net> wrote:
Introduce jsonb, a structured format for storing json.
The new format accepts exactly the same data as the json type. However, it is
stored in a format that does not require reparsing the orgiginal text in order
to process it, making it much more suitable for indexing and other operations.
Insignificant whitespace is discarded, and the order of object keys is not
preserved. Neither are duplicate object keys kept - the later value for a given
key is the only one stored.The new type has all the functions and operators that the json type has,
with the exception of the json generation functions (to_json, json_agg etc.)
and with identical semantics. In addition, there are operator classes for
hash and btree indexing, and two classes for GIN indexing, that have no
equivalent in the json type.This feature grew out of previous work by Oleg Bartunov and Teodor Sigaev, which
was intended to provide similar facilities to a nested hstore type, but which
in the end proved to have some significant compatibility issues.
Only noticed the one typo during a skim read...
In doc/src/sgml/json.sgml:
s/aquired/acquired/
--
Thom
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
On 03/23/2014 06:18 PM, Thom Brown wrote:
Only noticed the one typo during a skim read...
In doc/src/sgml/json.sgml:
s/aquired/acquired/
Thanks, fixed.
I'm expecting that several people will want to add to the docs.
cheers
andrew
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
On 03/24/2014 01:01 AM, Oleg Bartunov wrote:
Andrew,
Alexander Korotkov is an author of hash_ops ! I think he should be
granted. I wrote "Alexander Korotkov introduced an elegant hash
opclass for GIN, which competes with MongoDB performance in contains
operator".Oleg
PS.
Actually, it happened in Dublin, in the night before our
presentation. I was a bit upset to learn that MongoDB index performs
better than our GIN and was thinking in the background, what to say in
presentation. I and Alexander decided to walk in seaside, where I got
hashing idea, which Alexander also thought about. He quickly
implemented in the hotel, while we were waiting our food (at night !)
and first experiments shown the better than MongoDB performance !
After several rounds the code was accepted by Teodor and now is
shining in jsonb.
Oops. Apologies to Alexander - I should have listed him as an author.
We'll make sure he gets credit in the release notes.
cheers
andrew
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Import Notes
Reply to msg id not found: CAF4Au4wBQuY80ZMkd1cuCn2-6S4MmmZmgWr_q-15wrNCATy-EA@mail.gmail.com