For example, say I have a table with a medium number of rows (~100,000 or so) that has a jsonb
column with the following example data in one of the rows:
{"name":"Bob", "favoriteColor":"red", "someOtherObject": {"somethingElse": true}}
Is it more efficient to:
Use a GIN index on the jsonb column, then use Postgres' built-in JSON query functions to pull out data
Create several columns to represent things that can be searched for i.e. one column for
name
, one column forfavoriteColor
, etc; build b-tree indices on those columns and then run aselect document from table where name = 'Bob'
Some other solution?
Keep in mind the solution needs to efficiently support
like
queries to be able to search for values that start with a given input string.