public inbox for [email protected]  
help / color / mirror / Atom feed
From: Greg Sabino Mullane <[email protected]>
To: Durgamahesh Manne <[email protected]>
Cc: sud <[email protected]>
Cc: Erik Wienhold <[email protected]>
Cc: [email protected]
Cc: pgsql-general <[email protected]>
Subject: Re: Question on indexes
Date: Fri, 11 Oct 2024 08:48:19 -0400
Message-ID: <CAKAnmmKORn7S+Nc6Pr1y57hV2G833F6QyM9vhdFeoAZmTmdnSw@mail.gmail.com> (raw)
In-Reply-To: <CAJCZko+-DCLp75-9JvkYxjrnvFqCA++VN1yLhFgwCYJWvqp8rA@mail.gmail.com>
References: <CAD=mzVWLN35FHPxN0Ajh2vnDkFLyg9f0vT6EKF9uPm7CYkHS5g@mail.gmail.com>
	<[email protected]>
	<CAD=mzVWHC8O+fLksgc-uKAcq19xQSVvHz1AsButFmL+xh0_btg@mail.gmail.com>
	<CAKAnmmJW_pmtYLPyO2MONF+L_Wz_8kgPZE881cHPzd7MScrsXA@mail.gmail.com>
	<CAJCZko+-DCLp75-9JvkYxjrnvFqCA++VN1yLhFgwCYJWvqp8rA@mail.gmail.com>

(please start a new thread in the future rather than replying to an
existing one)

You cannot query on b and use an index on (a,b) as you observed. However,
you can have two indexes:

index1(a)
index2(b)

Postgres will be able to combine those when needed in the case where your
WHERE clause needs to filter by both columns. So then you no longer need
the two-column index.

Cheers,
Greg


view thread (9+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Question on indexes
  In-Reply-To: <CAKAnmmKORn7S+Nc6Pr1y57hV2G833F6QyM9vhdFeoAZmTmdnSw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox