pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joe Van Dyk <joe@tanga.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: querying jsonb for arrays inside a hash
Date: Sat, 07 Nov 2015 19:00:21 -0500
Message-ID: <25341.1446940821@sss.pgh.pa.us> (raw)
In-Reply-To: <CACfv+p+w0bJSqWSCa0sE1oJHAERbpN5m1sK0nkQos7HKE-3aFA@mail.gmail.com>
References: <CACfv+p+w0bJSqWSCa0sE1oJHAERbpN5m1sK0nkQos7HKE-3aFA@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

Joe Van Dyk <joe@tanga.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


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (3+ messages)  latest in thread

Message-ID: <25341.1446940821@sss.pgh.pa.us>
Permalink:  ../25341.1446940821@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25341.1446940821@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, joe@tanga.com
  Subject: Re: querying jsonb for arrays inside a hash
  In-Reply-To: <25341.1446940821@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox