pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: hukim99@gmail.com, PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Subject: Re: BUG #13874: The index of a json field which is created after data are inserted doesn't work.
Date: Mon, 18 Jan 2016 23:15:11 -0500
Message-ID: <29066.1453176911@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB7nPqRRmsQqj5grZvdqQz3wZLXSKB2jkbPWu0mXqsmpR_Yorg@mail.gmail.com>
References: <20160118123942.2961.98513@wrigleys.postgresql.org>
	<CAB7nPqRRmsQqj5grZvdqQz3wZLXSKB2jkbPWu0mXqsmpR_Yorg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Michael Paquier <michael.paquier@gmail.com> writes:
> On Mon, Jan 18, 2016 at 9:39 PM,  <hukim99@gmail.com> wrote:
>> The only difference between two instructions above is whether the index is
>> created before or after data insertion. Isn't it a bug?

> My guess is that there are invalid statistics on this table. If you
> run ANALYZE on json_test you should be able to see a sequential scan
> in the first case as well. It is weird that the planner chooses a
> bitmap scan in the first case for one tuple.

Yes, after an ANALYZE you'd get the same plan either way.  The difference
in behavior here is because you get sort of a half-baked ANALYZE
(specifically, an update in the table's recorded tuple count) at the time
of CREATE INDEX.  I don't think this is a bug; and I note that for this
size of table, it really hardly matters which plan the planner chooses.

			regards, tom lane


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



view thread (3+ messages)

Message-ID: <29066.1453176911@sss.pgh.pa.us>
Permalink:  ../29066.1453176911@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29066.1453176911@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, michael.paquier@gmail.com
  Subject: Re: BUG #13874: The index of a json field which is created after data are inserted doesn't work.
  In-Reply-To: <29066.1453176911@sss.pgh.pa.us>
  References: <20160118123942.2961.98513@wrigleys.postgresql.org> <CAB7nPqRRmsQqj5grZvdqQz3wZLXSKB2jkbPWu0mXqsmpR_Yorg@mail.gmail.com> <29066.1453176911@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