Hi, Having some trouble working out why my query isnt using an index (im pretty sure it should be as well)
I have this query
It is taking hours, rather than minutes.Code:UPDATE fld_detail
SET imsi = 1, imei = 1, imei_ts = 1,
imei_24h = :i_imei_imsi_24h, imsi_ts = :i_imsi_imei_ts,
imsi_24h = :i_imsi_imei_24h, overlap_calls_ts =
:i_overlap_calls_ts, overlap_calls_24h = :i_overlap_calls_24h,
overlap_calls_start_ts = :i_overlap_calls_start_ts,
overlap_calls_end_ts = :i_overlap_calls_end_ts, short_call_ts
= :i_short_call_ts, short_call_1h = :i_short_call_1h,
gen_duration_pattern_ts = :i_gen_duration_pattern_ts,
gen_duration_pattern_24h = :i_gen_duration_pattern_24h,
mobile_duration_pattern_ts = :i_mobile_duration_pattern_ts,
mobile_duration_pattern_24h = :i_mobile_duration_pattern_24h,
int_duration_pattern_ts = :i_int_duration_pattern_ts,
int_duration_pattern_24h = :i_int_duration_pattern_24h,
prs_duration_pattern_ts = :i_prs_duration_pattern_ts,
prs_duration_pattern_24h = :i_prs_duration_pattern_24h,
prepaid_credit_balance_ts = :i_prepaid_credit_balance_ts,
prepaid_credit_balance = nvl(prepaid_credit_balance,0) +
:i_pre_paid_delta_value, prepaid_credits =
:i_prepaid_number_of_credits
WHERE account_id = :i_account_id
The plan I am getting is..
This was taken from OEM while the session was still running.Code:Step Name Step Cost Rows Kbytes
Update Statement 4 1
Update 3
PARTITION HASH (Single) 2
CEREBRUS.FLD_DETAIL TABLE ACCESS FULL 1 1 1 0.086
The column account_id is the primary key on that table
I am surprised the cost is 1, seeing as though there are just under 400,000 records in that table (its grows daily)
I analyzed the table doing dbms_stats.gather_table_stats('SCHEMA_NAME','FLD_DETAIL') and it did that.
Still wont use my index though - in testing it has done as works quickly, so thats why I believe the optimizer is making a bad choice.
Weird this is, if I do a simple select count(*) from fld_detail where account_id = 'xxx' it does a unique scan on the index
Any advice?
Cheers
Dave
