-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the reasoning behind using JSONB in PostgreSQL? #27
Comments
/cc @prolic |
Just to give a bit of context: The PostgreSQL guys recommend using JSON when using the field just for storage and JSONB when you want to issue queries against the data. The reasoning behind this is that the conversion from JSON to the binary format of JSONB and back costs time to compute. In addition to that the JSON fields has 2 "advantages" over JSONB: The json format of the output does not change - e.g. the order of the object keys is maintained and since the JSON specification potentially allows multiple keys by the same name, the JSON field in PostgreSQL does the same. To be fair I have no idea what "more efficient" really means but with millions of events that get read and parsed maybe the JSON field access might be a bit faster. |
Jsonb can also be used with a custom persistance strategy, so I am okay
with switching the default to json.
Wanna submit a PR?
Am 02.01.2017 16:26 schrieb "Stephan Hochdörfer" <[email protected]>:
… Just to give a bit of context: The PostgreSQL guys recommend using JSON
when using the field just for storage and JSONB when you want to issue
queries against the data. The reasoning behind this is that the conversion
from JSON to the binary format of JSONB and back costs time to compute.
In addition to that the JSON fields has 2 "advantages" over JSONB: The
json format of the output does not change - e.g. the order of the object
keys is maintained and since the JSON specification potentially allows
multiple keys by the same name, the JSON field in PostgreSQL does the same.
To be fair I have no idea what "more efficient" really means but with
millions of events that get read and parsed maybe the JSON field access
might be a bit faster.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#27 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAYEvNE6KB6zl9bM-nEEtQxw1lTLzvoxks5rOLSYgaJpZM4LY4Li>
.
|
Sure can tackle that one as well ;) Migrate to JSON completely or make it configurable? What would you prefer? |
Migrate. As I said it is part of the persistance strategy and you can
always create a new one for userland, adding more indexes f.e. and so on.
Can we keep jsonb for metadata? This one will be queried a lot, depending
on the streaming configuration.
Am 02.01.2017 16:45 schrieb "Stephan Hochdörfer" <[email protected]>:
Sure can tackle that one as well ;)
Migrate to JSON completely or make it configurable? What would you prefer?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#27 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAYEvOkaKVZpfrxG7AABi01iQNNnZKAsks5rOLkKgaJpZM4LY4Li>
.
|
Sounds legit ;) |
Question taken from the chat. Asked by @shochdoerfer
The text was updated successfully, but these errors were encountered: