Closed omid closed 3 years ago
Yeah, I though I had documented somewhere that metadata keys cannot contain _
, but apparently not. Another alternative is to have a more unusual separator, and reject metadata keys that contain that separator.
Your solution should probably work as well, what kind of index should then be used for querying on JSONB?
JSONB is quite fast. For key/value scenario, a simple GIN index is enough.
Based on this link, this index is enough:
CREATE INDEX myindex ON mytable USING GIN (mycolumn jsonb_path_ops)
or to stand in a more safe side, we can use:
CREATE INDEX myindex ON mytable USING GIN (mycolumn)
And we can query like this:
SELECT * FROM mytable WHERE mycolumn @> '{"key": "value"}'
Nice, then I think that is what we should go for! I can change it within this week if you have not already started on this :)
Then I'll do it :) I'm in the middle of it :P
seems like I cannot assign issues to myself, you can assign this one to me
I invited you as a collaborator on the project now, then you should have more access :)
The current
metadata
storage is not safe.Currently, key and value is
_
separated and it's easily breakable if we have_
in thekey
. My suggestion is to use JSONB for the DB type and useserde
to (de)serialize it.