Number 2. But the sequence of columns is essential. Make it:
CREATE INDEX tbl_mult_idx ON tbl (tran_type, acct_id)
Also, it would be more effective to have an integer
column (or an enum
) instead of char(2)
for the type.
And use count(*)
instead of count(tran_id)
if tran_id
is defined NOT NULL
. It's a bit faster.
More details in this related answer on dba.SE