Re: Question on indexes

From: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
To: Durgamahesh Manne <maheshpostgres9(at)gmail(dot)com>
Cc: sud <suds1434(at)gmail(dot)com>, Erik Wienhold <ewie(at)ewie(dot)name>, xof(at)thebuild(dot)com, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Question on indexes
Date: 2024-10-11 12:48:19
Message-ID: CAKAnmmKORn7S+Nc6Pr1y57hV2G833F6QyM9vhdFeoAZmTmdnSw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

(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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message iseki 2024-10-11 13:00:25 Re: Questions about document "Concurrenry control" section
Previous Message Durgamahesh Manne 2024-10-11 12:31:58 Re: Question on indexes