pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Wells Oliver <wells.oliver@gmail.com>
Cc: Craig James <cjames@emolecules.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: Query planning around one key of a multi-column index
Date: Thu, 19 Dec 2019 00:47:09 -0500
Message-ID: <18012.1576734429@sss.pgh.pa.us> (raw)
In-Reply-To: <CAOC+FBWzn-TK99tZNP4s=HkFk1qWr6QXGnqDarLCKrBK5g_tXA@mail.gmail.com>
References: <CAOC+FBWZKgW9d2613DLg8MPfYXaQ3KweXFV3MWawK43rJt=C8Q@mail.gmail.com>
	<CAFwQ8reu3kbbREr2M2i-7o7C-UdTOpMybRyMzbkcCwjhmiyMYQ@mail.gmail.com>
	<CAOC+FBWzn-TK99tZNP4s=HkFk1qWr6QXGnqDarLCKrBK5g_tXA@mail.gmail.com>

Wells Oliver <wells.oliver@gmail.com> writes:
> Is it really always true that querying off any column that's not the first
> column of a multi-column index will NOT use that index?

Nope.  The planner will consider that, though in most cases it's likely
to estimate that there's no benefit to using the index in such cases.
Try reading the *actual* docs, not some third-party site:

https://www.postgresql.org/docs/current/indexes-multicolumn.html

			regards, tom lane





view thread (5+ messages)  latest in thread

Message-ID: <18012.1576734429@sss.pgh.pa.us>
Permalink:  ../18012.1576734429@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/18012.1576734429@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-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, wells.oliver@gmail.com, cjames@emolecules.com
  Subject: Re: Query planning around one key of a multi-column index
  In-Reply-To: <18012.1576734429@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