multiple indexes on the same column

From: Tiffany Thang <tiffanythang(at)gmail(dot)com>
To: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: multiple indexes on the same column
Date: 2019-04-12 10:54:37
Message-ID: CAB_W-NNpcyQEpMba42401yupk_7t4vY2cgA2gEty7oGTzUxd_w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
Can someone explain the use of creating multiple indexes on the same
column?

How would the optimizer determine which index to use? From my brief
testing, the optimizer picked the latest created index, testidx3. Can you
provide a scenario where creating multiple indexes on the same column would
be beneficial?

create table test (a int, b int);
create index testidx1 on test (a);
create index testidx2 on test (a);
create index testidx3 on test (a);

Thanks.

Tiff

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Geoff Winkless 2019-04-12 11:52:59 Re: multiple indexes on the same column
Previous Message rihad 2019-04-12 10:40:17 Re: When do vacuumed pages/tuples become available for reuse?