pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: pgsql-performance@postgresql.org
Subject: Re: working around JSONB's lack of stats?
Date: Wed, 28 Jan 2015 20:48:02 +0100
Message-ID: <54C93CF2.3020600@2ndquadrant.com> (raw)
In-Reply-To: <54C738E1.8080405@agliodbs.com>
References: <54C738E1.8080405@agliodbs.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

On 27.1.2015 08:06, Josh Berkus wrote:
> Folks,
> 
...
>
> On a normal column, I'd raise n_distinct to reflect the higher
> selecivity of the search terms.  However, since @> uses contsel,
> n_distinct is ignored.  Anyone know a clever workaround I don't
> currently see?

I don't see any reasonable workaround :-(

ISTM we'll have to invent a way to collect useful stats about contents
of JSON/JSONB documents. JSONB is cool, but at the moment we're mostly
relying on defaults that may be reasonable, but still misfire in many
cases. Do we have any ideas of how that might work?

We're already collecting stats about contents of arrays, and maybe we
could do something similar for JSONB? The nested nature of JSON makes
that rather incompatible with the flat MCV/histogram stats, though.

regards
-- 
Tomas Vondra                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
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 (13+ messages)  latest in thread

Message-ID: <54C93CF2.3020600@2ndquadrant.com>
Permalink:  ../54C93CF2.3020600@2ndquadrant.com/
Also on:    postgresql.org/message-id/54C93CF2.3020600@2ndquadrant.com

 · 

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: tomas.vondra@2ndquadrant.com
  Subject: Re: working around JSONB's lack of stats?
  In-Reply-To: <54C93CF2.3020600@2ndquadrant.com>

* 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