|
|
Re: Performance Due to Buffer Sort [message #351280 is a reply to message #351268] |
Tue, 30 September 2008 03:43 |
rleishman
Messages: 3728 Registered: October 2005 Location: Melbourne, Australia
|
Senior Member |
|
|
You get a BUFFER SORT in Explain Plan for some types of Parallel Queries. Certainly Partial Partition-wise joins can use a BUFFER SORT, I don't know if others can.
There are some examples in the Oracle Performance Tuning manual that show how one Explain Plan contains a BUFFER SORT and another - also a Partial Partition-wise join - does not. But it does not adequately explain (in a way that I can understand) why the two are different and what exactly they are doing differently.
If I were to GUESS (and that's what this is) I would say that it occurs when you perform a Partial Partition-Wise Join with a RANGE PARTITIONED table and a non-partitioned table. There seems to be some issue with the join that requires the parallel query buffers on the non-partitioned table to be sorted. I don't understand it.
I would appear from the examples that HASH partitioned (or sub-partitioned) tables do NOT require a BUFFER SORT when joining on the hash partition key.
Sorry I can't be more definitive.
Ross Leishman
|
|
|
Re: Performance Due to Buffer Sort [message #351485 is a reply to message #351268] |
Wed, 01 October 2008 01:49 |
coleing
Messages: 213 Registered: February 2008
|
Senior Member |
|
|
Also, if you have a parallel query that is specifying a parallel hint on only 1 table of a 2 table join, you will get a buffer sort as the join is performed by a serial process. you need to run the same level of parallel on both tables so that the join itself can be run in parallel and hence avoid the buffer sort.
Thsi applies to HASH joins.
[Updated on: Wed, 01 October 2008 01:52] Report message to a moderator
|
|
|
|
|
|
Re: Performance Due to Buffer Sort [message #351669 is a reply to message #351666] |
Thu, 02 October 2008 04:37 |
rleishman
Messages: 3728 Registered: October 2005 Location: Melbourne, Australia
|
Senior Member |
|
|
And here is the SQL formatted using the SQL Formatter on this site. Always handy to format if you want people to help.
SELECT *
FROM Shop_Ord
WHERE Contract IN (SELECT Contract
FROM Site_Public
WHERE Contract = User_Allowed_Site_aPi.Authorized(Contract))
AND Order_Code_db IN ('M',
'F',
'P')
AND (EXISTS (SELECT 1
FROM Shop_Material_Alloc sMa
WHERE (qty_Issued + sMa.qty_Assigned) < qty_Required
AND Shop_Ord.Release_No = sMa.Release_No
AND Shop_Ord.Order_No = sMa.Order_No
AND (sMa.Part_No IN (SELECT Inventory_Part_Location.Part_No
FROM Inventory_Part_Location
WHERE Inventory_Part_Location.qty_OnHand - Inventory_Part_Location.qty_Reserved > 0)))
AND (objState != 'Closed')
AND (Revised_Due_Date < SYSDATE + 30))
|
|
|
Re: Performance Due to Buffer Sort [message #351672 is a reply to message #351669] |
Thu, 02 October 2008 04:49 |
rleishman
Messages: 3728 Registered: October 2005 Location: Melbourne, Australia
|
Senior Member |
|
|
FIRST: Run the following and tell us how long it takes, and how many rows it returns:
SELECT Contract
FROM Site_Public
WHERE Contract = User_Allowed_Site_aPi.Authorized(Contract));
SECOND: Do qty_Issued and qty_Required come from Shop_Ord? Or from Shop_Material_Alloc?
Ross Leishman
|
|
|
Re: Performance Due to Buffer Sort [message #351963 is a reply to message #351672] |
Sat, 04 October 2008 00:16 |
senaka
Messages: 5 Registered: September 2008
|
Junior Member |
|
|
Hi Thanks for replies.
That user defined method does not take much time. Even u can igonore that time. Performance issue os there even for this query
SELECT *
FROM Shop_Ord
WHERE Order_Code_db IN ('M',
'F',
'P')
AND (EXISTS (SELECT 1
FROM Shop_Material_Alloc sMa
WHERE (qty_Issued + sMa.qty_Assigned) < qty_Required
AND Shop_Ord.Release_No = sMa.Release_No
AND Shop_Ord.Order_No = sMa.Order_No
AND (sMa.Part_No IN (SELECT Inventory_Part_Location.Part_No
FROM Inventory_Part_Location
WHERE Inventory_Part_Location.qty_OnHand - Inventory_Part_Location.qty_Reserved > 0)))
AND (objState != 'Closed')
AND (Revised_Due_Date < SYSDATE + 30))
that two fields are qty_Issued and qty_Required come from Shop_Material_Alloc.
Further investigations I found that Shop_ord table does not get filtered. When modify the query as below with key field in the shop_ord then this get populated with in few second.
SELECT *
FROM Shop_Ord
WHERE Order_Code_db IN ('M',
'F',
'P')
AND (EXISTS (SELECT 1
FROM Shop_Material_Alloc sMa
WHERE (qty_Issued + sMa.qty_Assigned) < qty_Required
AND Shop_Ord.Release_No = sMa.Release_No
AND Shop_Ord.Order_No = sMa.Order_No
AND (sMa.Part_No IN (SELECT Inventory_Part_Location.Part_No
FROM Inventory_Part_Location
WHERE Inventory_Part_Location.qty_OnHand - Inventory_Part_Location.qty_Reserved > 0)))
AND (objState != 'Closed')
AND (Revised_Due_Date < SYSDATE + 30)
OR PART_NO = ' '..
The appended OR condition works well for me as that OR condition is never get TRUE.
|
|
|