by jerrysievert · 9y ago · 0 comments
being able to have a field like:
ingredients VARCHAR[]
and index like: USING GIN (ingredients)
and using an operator like @> SELECT * FROM table WHERE ingredients @> ARRAY['mushrooms', 'sour cream']
gives you such amazing flexibility and speed, it's not even funny.also, while I was sad to not see PLV8 up there with PostGIS (an amazing extension, btw), I was still happy to see it mentioned with such gusto.
SELECT * FROM recipes r
INNER JOIN ingredients i ON (r.id = i.recipe_id)
WHERE i.ingredient IN ('mushrooms', 'sour cream')
load up some data and run explain analyze on both schemas/queries.