Suppose I wanted to be able to perform queries against three columns of my table: 'user_id', 'product_id' and 'created'. Most of the time I'll just be range-selecting records from the table ordering by 'created'. But I may also want to select where 'user_id' = something and 'product_id' in (list, of, ids), ordered by 'created'. Do I need two separate indexes, one on 'created' and another on ('user_id', 'product_id', 'created'), or does having only the latter suffice the former case?
-- Jonas, http://jonasgalvez.com.br