pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <kgrittn@ymail.com>
To: Michael Kolomeitsev <mkolomeitsev@gmail.com>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Pg makes nonoptimal choice between two multicolumn indexes with the same columns but in different order.
Date: Sat, 28 Dec 2013 13:03:28 -0800 (PST)
Message-ID: <1388264608.60549.YahooMailNeo@web122306.mail.ne1.yahoo.com> (raw)
In-Reply-To: <CAABbzO01zK4Ab=vd3UD1Jd++-Hju9bLerzS1+=JnpMsXCLtg8w@mail.gmail.com>
References: <CAABbzO01zK4Ab=vd3UD1Jd++-Hju9bLerzS1+=JnpMsXCLtg8w@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

Michael Kolomeitsev <mkolomeitsev@gmail.com> wrote:

> it is clear for me why t1_b_a_idx is better. The question is: Is
> postgresql able to see that?

For a number of reasons I never consider a bulk load complete until
I run VACUUM FREEZE ANALYZE on the table(s) involved.  When I try
your test case without that, I get the bad index choice.  When I
then run VACUUM FREEZE ANALYZE on the database I get the good index
choice.

There may be some lesser maintenance which sets up visibility
information and provides the planner with enough data to make a
good choice, I just noticed that you were not following what I
consider to be rote good practice, tried it, and it solved the
problem.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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

Message-ID: <1388264608.60549.YahooMailNeo@web122306.mail.ne1.yahoo.com>
Permalink:  ../1388264608.60549.YahooMailNeo@web122306.mail.ne1.yahoo.com/
Also on:    postgresql.org/message-id/1388264608.60549.YahooMailNeo@web122306.mail.ne1.yahoo.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: kgrittn@ymail.com, mkolomeitsev@gmail.com
  Subject: Re: Pg makes nonoptimal choice between two multicolumn indexes with the same columns but in different order.
  In-Reply-To: <1388264608.60549.YahooMailNeo@web122306.mail.ne1.yahoo.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