In Postgres is it possible to create an index on a jsonb[]
column?
I have a table that contains a set of jsonb[]
array, and each json in table A has a reference to another table B.
I want to have the count of element B in A when I select B.
I do something like :
SELECT
id,
(SELECT count(*)
FROM A, unnest(jsons) json
WHERE json->>'id' = B.id)
FROM B
That works but it is very slow :( !