JSON 与 JSONB Postgresql
JSON vs JSONB Postgresql
我正在阅读有关 JSON 和 JSONB 数据类型之间的差异的 PostgreSql 文档 https://www.postgresql.org/docs/13/datatype-json.html。
有这条线
The json data type stores an exact copy of the input text, which
processing functions must reparse on each execution; while jsonb data
is stored in a decomposed binary format that makes it slightly slower
to input due to added conversion overhead, but significantly faster to
process, since no reparsing is needed
我无法理解以文本格式存储和以二进制格式存储之间的区别是什么,字符串本身将存储为 0 和 1 的序列。
有人可以澄清一下吗?另外,它们之间会有尺寸差异吗?
正如文档中所写,它更快,因为它是针对 JSON 的优化格式。
The data types json and jsonb, as defined by the PostgreSQL
documentation,are almost identical; the key difference is that json
data is stored as an exact copy of the JSON input text, whereas jsonb
stores data in a decomposed binary form; that is, not as an
ASCII/UTF-8 string, but as binary code.
请阅读:https://www.compose.com/articles/faster-operations-with-the-jsonb-data-type-in-postgresql/
json
本质上是作为文本存储的,每次 operate 时都需要对其进行解析。这意味着它确实保留了空白格式并允许对象中的重复 属性 键等特性。
jsonb
是一种优化的二进制格式,表示嵌套数组和对象的树结构,可能更小(idk)存储起来稍大但更快访问和操作。
我正在阅读有关 JSON 和 JSONB 数据类型之间的差异的 PostgreSql 文档 https://www.postgresql.org/docs/13/datatype-json.html。
有这条线
The json data type stores an exact copy of the input text, which processing functions must reparse on each execution; while jsonb data is stored in a decomposed binary format that makes it slightly slower to input due to added conversion overhead, but significantly faster to process, since no reparsing is needed
我无法理解以文本格式存储和以二进制格式存储之间的区别是什么,字符串本身将存储为 0 和 1 的序列。
有人可以澄清一下吗?另外,它们之间会有尺寸差异吗?
正如文档中所写,它更快,因为它是针对 JSON 的优化格式。
The data types json and jsonb, as defined by the PostgreSQL documentation,are almost identical; the key difference is that json data is stored as an exact copy of the JSON input text, whereas jsonb stores data in a decomposed binary form; that is, not as an ASCII/UTF-8 string, but as binary code.
请阅读:https://www.compose.com/articles/faster-operations-with-the-jsonb-data-type-in-postgresql/
json
本质上是作为文本存储的,每次 operate 时都需要对其进行解析。这意味着它确实保留了空白格式并允许对象中的重复 属性 键等特性。
jsonb
是一种优化的二进制格式,表示嵌套数组和对象的树结构,可能更小(idk)存储起来稍大但更快访问和操作。