Skip to content

postgrespro/jsonb_schema

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This extension allows to reduce size of jsonb objects by storing it's schema separately from data. It is assumed that there are not so much different schema used by applications. So storing schema separately in jsonb_schemes table and keeping only it's ID in JSONB object allows to significantly reduce space used by JSONB objects.

There are just two functions provided by this extension: jsonb_pack and jsonb_unpack. Both take JSONB objects and return JSONB object.

jsonb_pack separates schema from data and stores schema in jsonb_schemes table (if not present yet). Then it constructs JSONB array [schema_id,obj_data]

jsonb_pack takes JSONB array [schema_id,obj_data], retrieve schema from jsonb_schemes table and merge it with object data, restoring original JSONB object.

About

Store jsonb schema separately from data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published