Re:RethinkDB versus PostgreSQL: my personal experience
by inopinatus on Friday February 10, 2017 @03:39AM
(#13614066)
I've deliberately avoided deep arrays for settings, so my jsonb settings merge is simply:
SELECT COALESCE(companies.options, '{}'::jsonb) || COALESCE(groups.options, '{}'::jsonb) || COALESCE(users.options, '{}'::jsonb)
FROM users
JOIN companies ON users.company_id = companies.id
LEFT JOIN groups ON users.group_id = groups.id
WHERE users.id = ?
Where I need a hierarchy for key names I'm just prefixing.
I sit right on the knife edge of tossing all the jsonb options and replacing with an old-school normalized EAV model.
I sit right on the knife edge of tossing all the jsonb options and replacing with an old-school normalized EAV model.