Re: querying jsonb for arrays inside a hash

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Van Dyk <joe(at)tanga(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: querying jsonb for arrays inside a hash
Date: 2015-11-08 00:00:21
Message-ID: 25341.1446940821@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Joe Van Dyk <joe(at)tanga(dot)com> 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, so a significant variation in runtime doesn't seem
that surprising to me ...

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Joe Van Dyk 2015-11-09 17:13:48 Re: querying jsonb for arrays inside a hash
Previous Message Joe Van Dyk 2015-11-07 23:31:18 querying jsonb for arrays inside a hash