You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can create a temporary table and write some common JSONB documents to it manually or use existing tables. The idea is to provide a subset of real data. Lets say some document *type* is twice as frequent as some other document type. ZSON expects that there will be twice more documents of the first type than of the second in a learning set.
78
+
You can create a temporary table and write some common JSONB documents to it manually or use existing tables. The idea is to provide a subset of real data. Lets say some document *type* is twice as frequent as some other document type. ZSON expects that there will be twice as many documents of the first type as those of the second one in a learning set.
79
79
80
80
Resulting dictionary could be examined using this query:
81
81
@@ -97,17 +97,17 @@ zson_test=# select x -> 'aaa' from zson_example;
97
97
?column? | 123
98
98
```
99
99
100
-
## Migrating to new dictionary
100
+
## Migrating to a new dictionary
101
101
102
102
When schema of JSONB documents evolve ZSON could be *re-learned*:
This time *second* dictionary will be created. Dictionaries are cached in memory so it will take about a minute before ZSON realizes that there is a new dictionary. After that old documents will be decompressed using old dictionary and new documents will be compressed and decompressed using new dictionary.
108
+
This time *second* dictionary will be created. Dictionaries are cached in memory so it will take about a minute before ZSON realizes that there is a new dictionary. After that old documents will be decompressed using the old dictionary and new documents will be compressed and decompressed using the new dictionary.
109
109
110
-
To find out which dictionary is used for given ZSON document use zson_info procedure:
110
+
To find out which dictionary is used for a given ZSON document use zson_info procedure:
111
111
112
112
```
113
113
zson_test=# select zson_info(x) from test_compress where id = 1;
@@ -119,7 +119,7 @@ zson_test=# select zson_info(x) from test_compress where id = 2;
119
119
zson_info | zson version = 0, dict version = 0, ...
120
120
```
121
121
122
-
If **all** ZSON documents are migrated to new dictionary the old one could be safely removed:
122
+
If **all** ZSON documents are migrated to the new dictionary the old one could be safely removed:
We can modify compress.pgbench and nocompress.pgbench so only documents with id in between of 1 and 3000 will be requested. It will simulate a case when all data *does* fit into memory. In this case we see 141K TPS (JSONB) vs 134K TPS (ZSON) which is 5% slower.
322
+
We can modify compress.pgbench and nocompress.pgbench so only the documents with id between 1 and 3000 will be requested. It will simulate a case when all data *does* fit into memory. In this case we see 141K TPS (JSONB) vs 134K TPS (ZSON) which is 5% slower.
323
323
324
-
Compression ratio could be different depending on documents, database schema, number of rows, etc. But in general ZSON compression is much better than build-in PostgreSQL compression (PGLZ):
324
+
The compression ratio could be different depending on the documents, the database schema, the number of rows, etc. But in general ZSON compression is much better than build-in PostgreSQL compression (PGLZ):
0 commit comments