I am calculating the resource cost:
SELECT NVL(sum(WT.TRANSACTION_QUANTITY* WTA.RATE_OR_AMOUNT),0)
-- INTO l_resource_cost
FROM APPS.WIP_TRANSACTION_ACCOUNTS WTA, APPS.WIP_TRANSACTIONS WT
WHERE WTA.TRANSACTION_ID = WT.TRANSACTION_ID
AND WTA.ORGANIZATION_ID = WT.ORGANIZATION_ID
AND WTA.ACCOUNTING_LINE_TYPE =7
AND WTA.WIP_ENTITY_ID = 1757957
AND wt.operation_seq_num = 10;
The tables are Oracle ebs WIP tables, the data is correct but this is need to be executed for thousands of records.
How can I tune it?
can I attache the explain plan here?
The following recommendations will help you in your SQL tuning process.
You'll find 3 sections below:
CREATE INDEX wip_transactions_idx_operation_transactio_organizati ON WIP_TRANSACTIONS (operation_seq_num,TRANSACTION_ID,ORGANIZATION_ID);
CREATE INDEX wip_accounts_idx_account_wip_id_transac_organiz ON WIP_TRANSACTION_ACCOUNTS (ACCOUNTING_LINE_TYPE,WIP_ENTITY_ID,TRANSACTION_ID,ORGANIZATION_ID);
SELECT
NVL(sum(WT.TRANSACTION_QUANTITY * WTA.RATE_OR_AMOUNT),
0)
FROM
APPS.WIP_TRANSACTION_ACCOUNTS WTA,
APPS.WIP_TRANSACTIONS WT
WHERE
WTA.TRANSACTION_ID = WT.TRANSACTION_ID
AND WTA.ORGANIZATION_ID = WT.ORGANIZATION_ID
AND WTA.ACCOUNTING_LINE_TYPE = 7
AND WTA.WIP_ENTITY_ID = 1757957
AND wt.operation_seq_num = 10