It depends.
Assuming we are talking only about default B-Tree indices. If other types of indexes, such as GIN or GiST , are not so simple.
In principle, an index on (a,b) is good for searches only on a , and another index only (a) not needed. ( But an additional index only for (b) generally makes sense! )
It may still be a good idea if column b large, so that only (a) index is substantially smaller.
You will need to consider the table size, available RAM, typical queries, involved data types, index size, overhead for each tuple and data size, data alignment and addition ... or just run tests with your actual data and queries (but carefully check what you are actually testing).
For example, if a and b at most 4 bytes ( integer , smallint , date , ...), the index on (a,b) will be as large as on just (a) , and there is no point in holding the second.
A more detailed answer to dba.SE for this case.
The guide for the current version of Postgres is always a good source for more details.
source share