Skip to content

siilike/postgresql-vpack

Repository files navigation

PostgreSQL VelocyPack extension

This extension adds the velocypack format support to PostgreSQL. Generally it is a jsonb analogue with more data types and support for logical types or tags.

It supports most jsonb_* functions as vpack_*, jsonpath analogue vpackpath and conversion from the json, jsonb and BSON formats.

Some bits and pieces haven't been implemented yet.

Advantages

  • more data types than JSON
  • same format for data processing, transport and storage
  • logical types or tagging: for more precise type or object document mapping

Performance

Benchmark PostgreSQL (jsonb), PostgreSQL (vpack) and MongoDB

  • 16 parallel clients, 10^6 records, 5 minutes
  • left axis: average requests per second
  • top left: inserts -- VPack is a bit faster, because it did not perform input validation
  • top right: selects by primary key -- VPack is faster due to lack of conversion to text
  • bottom left: a simple aggregate operation
  • bottom right: transactions

TODO

Building

Install bison, flex, cmake, gcc.

git submodule update --recursive

(
	mkdir build-mongo
	cd build-mongo
	cmake -DCMAKE_C_FLAGS="-fPIC" ../mongo-c-driver/
	make -j 12
)

(
	mkdir build
	cd build
	cmake ..
	make -j 12
	make install
)

Then run CREATE EXTENSION vpack;. See vpack--0.1.sql for available functions, operators and casts.