This is a kind of document, there are
many other kinds, with different json structure. So, a general
index would be better.
But even if I create a specific index CREATE INDEX on datatable (((jsonfield#>>'{path1,path2}')::numeric)); it isn't used in such a query; it is used in this query: select field1,field2 from datatable where (jsonfield#>>'{path1,path2}')::numeric = 1000; Definitely, I didn't find a way to optimize a query that checks a range in a json subfield.
|