Re: Query planning around one key of a multi-column index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Wells Oliver <wells(dot)oliver(at)gmail(dot)com>
Cc: Craig James <cjames(at)emolecules(dot)com>, pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Query planning around one key of a multi-column index
Date: 2019-12-19 05:47:09
Message-ID: 18012.1576734429@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Wells Oliver <wells(dot)oliver(at)gmail(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Douglas Reed 2019-12-19 06:57:44 Problem with Altering a table column
Previous Message pratmeht 2019-12-19 05:02:44 Re: DDLs of a Function