Postgres seems to use indexes in the wrong order

From: Tim Uckun <timuckun(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Postgres seems to use indexes in the wrong order
Date: 2015-01-23 07:04:34
Message-ID: CAGuHJrNtjab6u5aW75VWciho0pzX+HDPUDyFUUCaWp0jJ6M9Vw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Take a look at this explain

http://explain.depesz.com/s/TTRN

The final number of records is very small but PG is starting out with a
massive number of records and then filtering most of them out.

I don't want to really force pg to always use the same index because in
some cases this strategy would win but I am wondering if there is anything
I need to do in order to get the planner to make better decisions.

I already did an analyze on the table.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christophe Pettus 2015-01-23 07:20:50 Retrieving the role in a logical replication plugin
Previous Message Bruce Momjian 2015-01-23 03:47:50 Re: pg_upgrade could not connect to server