Hi all,
I need some help on indexing a table around 10 million rows.
Basically, the table contains
Table: Account
unique_number
account_type (There are about 10 account types)
account_number
account_name
SSN
account_amount
This table is used both for query and reports.
At first, I create an index on account_type, account_number and
account_amount. It works great except when I try to combine this table
with the address table, and I want to select the address for everyone
with a specific type. Since the query has account_type, it used this
index which made the query very slow.
I then drop and create a new index just on account_number and
account_amount, but why is the query slow when I do the following?
select unique_number
from account
where account_type = 'a'
and account_number like '999'
and account_amount = 100
What is the best way to tackle and create the appropriate index.
Should I just make the index account_number, acocunt_type,
account_amount?
Thanks for the help!