How do you create a Postgresql JSONB array in array index?
问题 I have structure like this: user_id, a. a is of type jsonb and has the following structure: { b: [ {ids: [1,2,3,4]}, {ids: [2,3,4]}, {ids: [1,2,4]}, ... ] } How would I make an index that enabled me to find all users (user_id) that has a certain id in the ids list? 回答1: Is a GIN index what you want? It seems that you first need to organized the IDs into a form that is more tractable. I'm more familiar with Python than I am with the PostgreSQL ways of manipulating JSON, so I used PL/Python for