From: Shantanu Shekhar <shekharshan@yahoo.com>
To: Pgsql-general General <pgsql-general@postgresql.org>
Subject: Multi-column index vs index on individual columns
Date: Sat, 26 Dec 2020 20:18:21 +0000 (UTC)
Message-ID: <1135969024.2853124.1609013901725@mail.yahoo.com> (raw)
References: <1135969024.2853124.1609013901725.ref@mail.yahoo.com>
Hi,
I was going through Postgres documentation on multi-column indexes and came across the recommendation at the bottom states: "Multicolumn indexes should be used sparingly. In most situations, an index on a single column is sufficient and saves space and time".
In my experience typical webapps the queries are known ahead of time and lot of the times the queries are restricted to a single table (no joins). Does this recommendation that still apply in this use-case? I was under the impression that instead of scanning multiple indexes and then combining the results, it may be more performant to simply use a single multi-index column.
Thanks,
Shantanu
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: shekharshan@yahoo.com
Subject: Re: Multi-column index vs index on individual columns
In-Reply-To: <1135969024.2853124.1609013901725@mail.yahoo.com>
References: <1135969024.2853124.1609013901725.ref@mail.yahoo.com> <1135969024.2853124.1609013901725@mail.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