Multicolumn index for single-column queries? - Mailing list pgsql-general

From rihad
Subject Multicolumn index for single-column queries?
Date
Msg-id 95ade9a3-6846-3f55-f936-85b8bb4b46a8@mail.ru
Whole thread Raw
Responses Re: Multicolumn index for single-column queries?  (Gavin Flower <GavinFlower@archidevsys.co.nz>)
Re: Multicolumn index for single-column queries?  (Andreas Kretschmer <andreas@a-kretschmer.de>)
List pgsql-general
Hi. Say there are 2 indexes:

     "foo_index" btree (foo_id)

     "multi_index" btree (foo_id, approved, expires_at)


foo_id is an integer. Some queries involve all three columns in their WHERE clauses, some involve only foo_id.
Would it be ok from general performance standpoint to remove foo_index and rely only on multi_index? I know that
PG would have to do less work updating just one index compared to updating them both, but wouldn't searches
on foo_id alone become slower?

Thanks.




pgsql-general by date:

Previous
From: Julie Nishimura
Date:
Subject: Re: ERROR: operator class "gin__int_ops" does not exist for accessmethod "gin"
Next
From: Gavin Flower
Date:
Subject: Re: Multicolumn index for single-column queries?