Re: [PERFORM] querying jsonb for arrays inside a hash

2015-11-09 Thread Joe Van Dyk
You're right, brain fart. Nevermind! :) On Sat, Nov 7, 2015 at 4:00 PM, Tom Lane wrote: > Joe Van Dyk writes: > > I noticed that querying for > >product_attributes @> '{"upsell":["true"]}' > > is much slower than querying for > >product_attributes @> '{"upsell": 1}' > > > Is that expect

Re: [PERFORM] querying jsonb for arrays inside a hash

2015-11-07 Thread Tom Lane
Joe Van Dyk writes: > I noticed that querying for >product_attributes @> '{"upsell":["true"]}' > is much slower than querying for >product_attributes @> '{"upsell": 1}' > Is that expected? Your EXPLAIN results say that the first query matched 135843 rows and the second one none at all, s

[PERFORM] querying jsonb for arrays inside a hash

2015-11-07 Thread Joe Van Dyk
I noticed that querying for product_attributes @> '{"upsell":["true"]}' is much slower than querying for product_attributes @> '{"upsell": 1}' Is that expected? I have a gin index on product_attributes. I'm using 9.4.1. explain analyze select count(*) from products where product_attributes