Hi Gurus,
I have a query which I need to tune. Its running on a 32 CPU/64GB RAM HP-UX machine with 9i database for a Oracle E-Buss Suite application.
The query is as below:
SELECT 3 Type , soh . header_id , sol . line_id , soh . order_number , tt . name , sol . line_number
FROM apps.oe_order_lines_all sol , apps.oe_order_headers_all soh , apps.oe_transaction_types_tl tt , apps.mtl_system_items_vl mtlv
WHERE : P_ACTIONS = 'SCHED_NOT_PK'
AND ( soh.header_id = sol.header_id
AND nvl ( sol.schedule_status_code , 'N' ) = 'SCHEDULED'
AND nvl ( sol.shipping_interfaced_flag , 'N' ) = 'N'
AND mtlv.inventory_item_id = sol.inventory_item_id
AND mtlv.organization_id = sol.ship_from_org_id
AND tt.language = userenv ( 'LANG' )
AND tt.transaction_type_id = soh.order_type_id
AND nvl ( sol.open_flag , 'N' ) = 'Y'
AND sol.schedule_ship_date <= ( sysdate - : P_OVERDUE_DAYS ) )
and nvl ( soh.org_id , 0 ) = nvl ( : p_org_id , 0 )
and nvl ( sol.org_id , 0 ) = nvl ( : p_org_id , 0 )
The problem here is that in this 3 million rows table there are two distinct org_id 's and 1 one them (which is mostly used in the queries) is used in 80% of the rows in the table.
I wanted to know what are options for tuning this query with such large data volumes. Purging and Archiving are not in currently being considered as a short term solution. I doubt if Partitioning will really help due to the low-cardinality of the data.
Hi,
correct me if I am wrong BUT
The first plan shows that the select statement returns 225K rows
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost |
-------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 225K| 26M| | 2357K|
The second one returns only 1 row
------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 122 | 824K|
About your question, you cannot make a low cardinality column selective. You should use another column to apply a stronger predicate on it
Bookmarks