Hi,
This is Bhargav and I am trying to tune this query that is being used in a discoverer report and the columns in the select statement are the ones that are to be displayed in the discoverer output.
Can somebody help me as top how to tune this query. Any sort of help is greatly appreciated , as this is of high priority.
Regards,
Bhargav. - select
-
cost_orgs.organization_code || ' - ' || cost_orgs.organization_name cost_org,
-
on_hand_orgs.organization_code || ' - ' || on_hand_orgs.organization_name on_hand_org,
-
msi.segment1 item_name,
-
msi.description item_desc,
-
mcb.segment1 cost_cat_1,
-
mcb.segment2 cost_cat_2,
-
mcb.segment3 cost_cat_3,
-
mcb.segment1 || '.' || mcb.segment2 || '.' || mcb.segment3 cost_category,
-
upper(ctf1.cost_type) cost_type_1,
-
cicf1.item_cost item_cost_1,
-
cicf1.material_cost mtl_cost_1,
-
upper(ctf2.cost_type) cost_type_2,
-
cicf2.item_cost item_cost_2,
-
cicf2.material_cost mtl_cost_2,
-
sum(moh.transaction_quantity) on_hand_qty,
-
decode(msi.planning_make_buy_code,1,'M','B') make_buy_flag
-
from
-
-- mtl_parameters mp,
-
cst_item_costs cicf1,
-
cst_cost_types ctf1,
-
cst_item_costs cicf2,
-
cst_cost_types ctf2,
-
mtl_onhand_quantities moh,
-
inv.mtl_categories_b mcb,
-
inv.mtl_item_categories mic,
-
-- inv.mtl_category_sets_tl mcst,
-
org_organization_definitions cost_orgs,
-
org_organization_definitions on_hand_orgs,
-
inv.mtl_system_items_b msi
-
where 1=1
-
and cost_orgs.organization_id = msi.organization_id
-
and cicf1.organization_id = msi.organization_id
-
and cicf1.inventory_item_id = msi.inventory_item_id
-
and ctf1.cost_type_id = cicf1.cost_type_id --this should be set to frozen
-
and cicf2.organization_id = msi.organization_id --cross-product between sets will be resolved by Discoverer parameters
-
and cicf2.inventory_item_id = msi.inventory_item_id
-
and ctf2.cost_type_id = cicf2.cost_type_id
-
and moh.organization_id = on_hand_orgs.ORGANIZATION_ID
-
and moh.inventory_item_id = msi.inventory_item_id
-
and mic.organization_id (+) = msi.organization_id
-
and mic.inventory_item_id (+) = msi.inventory_item_id
-
and mic.category_set_id (+) = 1100000006 --inventory cost category
-
and mcb.category_id (+)= mic.category_id -- the inventory cost category consisists of mcb. segment1,2 and 3
-
--and mcst.CATEGORY_SET_ID = mic.CATEGORY_SET_ID
-
--and mcst.CATEGORY_SET_NAME = 'QC INVENTORY CATEGORY'
-
--and msi.inventory_item_id = 512
-
--and cicf1.COST_TYPE_ID = 1
-
--and cicf2.COST_TYPE_ID = 1101
-
--and msi.ORGANIZATION_ID = 89
-
group by
-
cost_orgs.organization_code || ' - ' || cost_orgs.organization_name,
-
on_hand_orgs.organization_code || ' - ' || on_hand_orgs.organization_name,
-
msi.segment1,
-
msi.description,
-
mcb.segment1,
-
mcb.segment2,
-
mcb.segment3,
-
mcb.segment1 || '.' || mcb.segment2 || '.' || mcb.segment3,
-
upper(ctf1.cost_type),
-
cicf1.item_cost,
-
cicf1.material_cost,
-
upper(ctf2.cost_type),
-
cicf2.item_cost,
-
cicf2.material_cost,
-
decode(msi.planning_make_buy_code,1,'M','B')
-
--order by msi.SEGMENT1
/
3 4035
Make use of HINTS in the query (HINT - INDEX,PARALLEL will be helpful)
Hi Amit,
I am not so familiar with using Hints in the sql query.
Can you pls give a small example and tell me which hint to use in this scenario, where so many joins are there.
Will appreciate your response in the earliest possible time.
Thanks,
Bhargav.
Hi Amit,
I am not so familiar with using Hints in the sql query.
Can you pls give a small example and tell me which hint to use in this scenario, where so many joins are there.
Will appreciate your response in the earliest possible time.
Thanks,
Bhargav.
Hi Bhargav,
You can make us of HINTS in your sql query to improve the performance of the Query.
There are many HINTS availabe with oracle that can be used but to make use of
the appropriate one will improve the performance.
See below example on making use of INDEX HINT in SQL Query: -
SELECT /* INDEX(<table_alias>,<index_name>) */ FROM table_name table_alias
-
Find more about INDEX HINT here
Another HINT PARALLEL can be used for parallel execution of your Query.
See more about usage of PARALLEL HINT here Sign in to post your reply or Sign up for a free account.
Similar topics
by: Arni Snorri Eggertsson |
last post by:
Hi
I am trying to design an IO subsystem for my SQL Server and for that I
need to try and predict IO activity on each table in my MSSQL
Database. My idea is to move the hottest tables into...
|
by: majsen |
last post by:
Hi, I have problem running this query. It will time out for me...
My database are small just about 200 members.
I have a site for swaping appartments (rental). my query should look
for match
in...
|
by: crystal1 |
last post by:
Just curious if anyone has a script to find and delete all indexes
created by index tuning wizard, leaving the original indexes untouched.
All of the original indexes in this particular database...
|
by: bala |
last post by:
hi!!!
the following is the sql which is veri slow cos of the 'Not In' clause,
would appreciate if u anyone can suggest any other way to bring about
the same result
SELECT Id, LOC, AGENCY,...
|
by: Ed L. |
last post by:
The planner is choosing a sequential scan for my query. I am trying
to understand why since it is clearly not the fastest choice, and
what the proper tuning dial is to adjust here. Here's the...
|
by: meytal.weiss |
last post by:
Hi,
I am using the dta utility successfully.
I have problem to tune query without specifying the schema as prefix in
case the tuning session is not with the login that own the schema, the
dta...
|
by: mleal |
last post by:
Does anyone have some more detailed information about how Oracle and MS
implement / allow Tuning on Oracle 10g and SQL Server 2005 and the
differences between them?
Which of them, In a deep...
|
by: Medhatithi |
last post by:
Hi,
I have been in several ways benefiited from this site. I would like to share some sql tuning techniques(simple, but effective) with you all.
SQL Tuning Tips
Oracle Tips Session #6 ...
|
by: Vinod Sadanandan |
last post by:
A Roadmap To Query Tuning
============================
For each SQL statement, there are different approaches that could be used to retrieve the required data. Optimization is the process of...
|
by: dunleav1 |
last post by:
In 9.1 and 9.5 (Linux 64 bit) when a buffer pool is set to self-
tuning, how are blocks configured in respect to blocked vs non-blocked
when self-tuning is set to on?
(ie) I have one bufferpool...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |