Bug #11168

Updated by Tom Clegg almost 3 years ago

Currently hashes (like log properties) and arrays (like api_client_authorization scopes) are encoded in YAML, which is much slower than Oj.

YAML has some features that JSON is missing, but we don't want them; in fact, they get in our way (like in #6347).

If we store JSON, and tell PostgreSQL ≥9.3 that we are doing so, we can do queries on serialized fields. https://www.postgresql.org/docs/9.6/static/datatype-json.html

h3. Implementation notes

* It's possible to do the up-migration in the background while the new server is running. We can detect format when loading, and deserialize accordingly: JSON starts with "{" or "[", YAML starts with "---".
* However, for a downgrade, a full down-migration would need to finish before the old version could work.
* In this version we won't bother migrating existing records -- we'll just use JSON in new/updated rows.

Changing column types:
* PostgreSQL can help us more if we use a json or jsonb column type for serialized fields -- but this -can- will can be deferred to a separate story.