To avoid this, you may consider storing data that you may aggregate later on regular fields.įor further commentary about this issue, you can read Heap's blog post When To Avoid JSONB In A PostgreSQL Schema. All of this will be unavailable when the info is entered as JSON fields, and you will suffer a heavy performance penalty especially when aggregating data ( COUNT, AVG, SUM, etc) among tons of JSON fields. The reason behind this last issue is that, for any given column, PostgreSQL saves descriptive statistics such as the number of distinct and most common values, the fraction of NULL entries, and -for ordered types- a histogram of the data distribution. certain queries (especially aggregate ones) may be slower due to the lack of statistics.it may take more disk space than plain json due to a larger table footprint, though not always,.slightly slower input (due to added conversion overhead),.simpler schema designs (replacing entity-attribute-value (EAV) tables with jsonb columns, which can be queried, indexed and joined, allowing for performance improvements up until 1000X!).
0 Comments
Leave a Reply. |