|
|
|
|
|
Re: Query tuning [message #507851 is a reply to message #507849] |
Wed, 18 May 2011 04:39   |
cookiemonster
Messages: 13965 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Ok so there is another way, still count(*) is obvious (and more accurate than num_rows).
However you really ought to know already if they have the similar amounts of data or not. Presumably you know how the tables are populated in each case?
This is really basic information for tuning.
|
|
|
|
Re: Query tuning [message #507867 is a reply to message #507865] |
Wed, 18 May 2011 05:51   |
cookiemonster
Messages: 13965 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
By how much?
If, as I suspect, UAT has a lot more data, then you would expect the query there to take longer and use a different plan.
It'll still need tuning, but comparing it to dev is fairly pointless in that case.
|
|
|
|
Re: Query tuning [message #507870 is a reply to message #507868] |
Wed, 18 May 2011 06:03   |
Roachcoach
Messages: 1576 Registered: May 2010 Location: UK
|
Senior Member |
|
|
(Your original post is a shining example of why cost should not be used...)
I digress: Cookiemonsters reply is basically saying you cannot compare the run times as the situation is not the same.
It is akin to saying a 400 mile drive takes longer than a 40 mile drive, what is wrong with my route?
[Updated on: Wed, 18 May 2011 06:04] Report message to a moderator
|
|
|
|
Re: Query tuning [message #507885 is a reply to message #507884] |
Wed, 18 May 2011 06:50   |
cookiemonster
Messages: 13965 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Though having re-read your original post it appears you do know what an explain is, so I really have no idea what prompted that question.
|
|
|
|
Re: Query tuning [message #507924 is a reply to message #507921] |
Wed, 18 May 2011 08:52   |
cookiemonster
Messages: 13965 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
We know. So what?
You asked why it was running faster in dev than UAT - answer is that UAT has a lot more data. That was easy to work out.
If you want us to help tune the query, that's not so easy and we'll require a lot more information - read the sticky at the top of this forum and supply all the requested information.
|
|
|
|
|
Re: Query tuning [message #507931 is a reply to message #507924] |
Wed, 18 May 2011 09:22   |
cookiemonster
Messages: 13965 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
cookiemonster wrote on Wed, 18 May 2011 14:52read the sticky at the top of this forum and supply all the requested information.
|
|
|
|
|
|
|
|
|
Re: Query tuning [message #507942 is a reply to message #507937] |
Wed, 18 May 2011 09:49   |
cookiemonster
Messages: 13965 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
A quick look at metalink shows that switching that parameter on causes oracle to spend more time parsing a query in order to try and find a better plan. It is also a hidden parameter and as such should only be set under Oracle Supports recommendation. Maybe you should find out who set it in your UAT environment and ask them why. Especially since that parameter will affect all queries and not just your problem one.
I would be very surprised if changing it got you a 2 second response time on UAT though.
EDIT: typo
[Updated on: Wed, 18 May 2011 09:50] Report message to a moderator
|
|
|
|
Re: Query tuning [message #507944 is a reply to message #507942] |
Wed, 18 May 2011 09:52   |
cookiemonster
Messages: 13965 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
1) Post thq query and explain plan directly in your post in [code] tags. A lot of people won't download attachments.
2) Use the following method for generating the explain, it's easier for us to read:
SQL> explain plan for select * from dual;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 3543395131
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2 | 2 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| DUAL | 1 | 2 | 2 (0)| 00:00:01 |
--------------------------------------------------------------------------
8 rows selected.
SQL>
3) Make sure you give the explain from UAT.
|
|
|
|
Re: Query tuning [message #507950 is a reply to message #507947] |
Wed, 18 May 2011 10:11   |
Database admin
Messages: 365 Registered: September 2006 Location: india
|
Senior Member |
 
|
|
Dev
TABLES ROWS
------------ --------
DISTRIBUTED_MATERIALS -- 1282029
RECEIVED_MATERIALS ---- 995301
REQUISITION_LINES -------- 830939
TASKS -------------- 17582228
CREWS -------------- 4681
MATERIAL_TYPES --------- 66015
EWO EWO, --------- 1123845
YARDS ---------- 3353
GEOLOCS ---------- 1011233
LOCATIONS ---------- 2022369
ACAS_CONTRACTORS --- 2167
MTL_SIGN_OUT -- 165348
UAT
---------
TABLES ROWS
------------ --------
DISTRIBUTED_MATERIALS, -- 1251277
RECEIVED_MATERIALS RM, ---- 930124
REQUISITION_LINES -------- 770827
TASKS TSK, -------------- 18245448
CREWS CRW, -------------- 3733
MATERIAL_TYPES --------- 68166
EWO EWO, --------- 1205687
YARDS YARD ---------- 3367
GEOLOCS GLOC ---------- 1275965
LOCATIONS LOC ---------- 1275965
ACAS_CONTRACTORS CONT --- 2885
MTL_SIGN_OUT SIGN_OUT -- 249704
[Updated on: Wed, 18 May 2011 10:13] Report message to a moderator
|
|
|
|
Re: Query tuning [message #507953 is a reply to message #507951] |
Wed, 18 May 2011 10:19   |
Database admin
Messages: 365 Registered: September 2006 Location: india
|
Senior Member |
 
|
|
Dev
TABLES ROWS
------------ --------
DISTRIBUTED_MATERIALS -- 1282029
RECEIVED_MATERIALS ---- 995301
REQUISITION_LINES -------- 830939
TASKS -------------- 17582228
CREWS -------------- 4681
MATERIAL_TYPES --------- 66015
EWO EWO, --------- 1123845
YARDS ---------- 3353
GEOLOCS ---------- 1011233
LOCATIONS ---------- 2022369
ACAS_CONTRACTORS --- 2167
MTL_SIGN_OUT -- 165348
UAT
---------
TABLES ROWS
------------ --------
DISTRIBUTED_MATERIALS, -- 1251277
RECEIVED_MATERIALS RM, ---- 930124
REQUISITION_LINES -------- 770827
TASKS TSK, -------------- 18245448
CREWS CRW, -------------- 3733
MATERIAL_TYPES --------- 68166
EWO EWO, --------- 1205687
YARDS YARD ---------- 3367
GEOLOCS GLOC ---------- 1275965
LOCATIONS LOC ---------- 1275965
ACAS_CONTRACTORS CONT --- 2885
MTL_SIGN_OUT SIGN_OUT -- 249704
Is this OK now ? I dont need to choose another job.If you can answer my question
help me else dont post anything here.
[Updated on: Wed, 18 May 2011 10:19] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Query tuning [message #507962 is a reply to message #507957] |
Wed, 18 May 2011 10:32   |
cookiemonster
Messages: 13965 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
balaji14 wrote on Wed, 18 May 2011 16:24i gave the command but it did not generate explain plan
Copy and paste the execution here. Use [code] tags as described here
And if you don't start formatting things properly I'm going to lose patience with you as well - you have been pointed to the guidelines before.
|
|
|
|
|
|
Re: Query tuning [message #507987 is a reply to message #507967] |
Wed, 18 May 2011 14:18   |
cookiemonster
Messages: 13965 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
@balaji14 - take a long hard look at the explain plan you posted. Then take a long hard look at the example I posted. Realise that mine is easy to follow and yours isn't at all.
We have pointed you, repeatedly, to really simple and easy to follow instructions as to how to format your post so it looks like my exmaple.
This leads to one of 2 conclusions:
1) You can't understand the really simple instructions - in which case you have no hope what so ever of being a programmer and need to find a new job.
2) You're too lazy to follow them - in which case no here is going to bother to try and help you again.
|
|
|