Criteria to define indexes - Mailing list pgsql-sql

From JORGE MALDONADO
Subject Criteria to define indexes
Date
Msg-id CAAY=A78QxH4qvVW5L58ORQC_DVoOQT-MAHc-WNs70-mHJjxQvg@mail.gmail.com
Whole thread Raw
Responses Re: Criteria to define indexes
List pgsql-sql
I have a table with fields as follows:

* sag_id
* sag_header
* sag_comments
* sag_date
* sag_section_id (**)
* sag_artist_id (**)
* sag_author_id (**)
* sag_producer_id (**)

As you can see, fields mark with (**) are identifiers that reference another table (catalog of sections, catalog of artists, etc). Firstly, I need an index on "sag_date" because our application has a search option under this criteria. However, there are also search criterias on "sag_section", "sag_artist", "sag_author" and "sag_producer" because, for example, a user may need to get the records of certain artist only. Furthermore, our application offers a user to select several cominations of criterias:

* Artist + Author
* Artist + Producer
* Artist + Author + Producer
* Section + Artist.

And so on. What I see is that it is not a good decision to set a key for every possibility because it will have an impact on performance due to index maintenance. What would be a good way to define indexes in a case like this?

With respect,
Jorge Maldonado

pgsql-sql by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Unique index and unique constraint
Next
From: David Johnston
Date:
Subject: Re: Criteria to define indexes