pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: AminPG Jaffer <aminjaffer.pg@gmail.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: Incorrect index used in few cases..
Date: Tue, 18 Jun 2019 18:23:00 -0400
Message-ID: <25880.1560896580@sss.pgh.pa.us> (raw)
In-Reply-To: <20190618221346.a5ql6n5s2zaheufb@alap3.anarazel.de>
References: <CAJ9dAqn5UzOQ4wVoCxXPGEu3+WJeZ35xY0bijA4XEpizU8SS5g@mail.gmail.com>
	<802.1560864908@sss.pgh.pa.us>
	<CAJ9dAq=mvWapLyo7y-ERc4WD=7cFM3nP9Zx_F6-zAdSnezX_=g@mail.gmail.com>
	<23028.1560892075@sss.pgh.pa.us>
	<20190618221346.a5ql6n5s2zaheufb@alap3.anarazel.de>

Andres Freund <andres@anarazel.de> writes:
> Are those indexes used for other queries? Any chance they've been
> recently created?

> SELECT indexrelid::regclass, xmin, indcheckxmin, indisvalid, indisready,
> indislive, txid_current(), txid_current_snapshot()
> FROM pg_index WHERE indrelid = 'tc'::regclass;

> might tell us.

Oh, that's a good idea.

> Amin, might be worth to see what the query plan is if you disable that
> index. I assume it's too big to quickly drop (based on the ?

Considering that the "right" query plan would have a cost estimate in
the single digits or close to it, I have to suppose that the planner is
rejecting that index as unusable, not making a cost-based decision not
to use it.  (Well, maybe if it's bloated by three orders of magnitude
compared to the other indexes, it'd lose on cost.  Doesn't seem likely
though.)

So I think we're looking for a hard "can't use the index" reason, and
now we've eliminated datatype mismatch which'd be the most obvious
such reason.  But index-isnt-valid or index-isnt-ready might do the
trick.

			regards, tom lane





view thread (9+ messages)  latest in thread

Message-ID: <25880.1560896580@sss.pgh.pa.us>
Permalink:  ../25880.1560896580@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25880.1560896580@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, andres@anarazel.de, aminjaffer.pg@gmail.com, pgsql-performance@lists.postgresql.org
  Subject: Re: Incorrect index used in few cases..
  In-Reply-To: <25880.1560896580@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