Index design for queries using 2 ranges

Viewed 2940

I am trying to find out how to design the indexes for my data when my query is using ranges for 2 fields.

expenses_tbl:
idx        date     category      amount
auto-inc   INT       TINYINT      DECIMAL(7,2)
PK

The column category defines the type of expense. Like, entertainment, clothes, education, etc. The other columns are obvious.

One of my query on this table is to find all those instances where for a given date range, the expense has been more than $50. This query will look like:

SELECT date, category, amount 
FROM expenses_tbl
WHERE date > 120101 AND date < 120811 
      AND amount > 50.00;

How do I design the index/secondary index on this table for this particular query.

Assumption: The table is very large (It's not currently, but that gives me a scope to learn).

3 Answers
Related