Help me to reduce buffer gets of following query
Buffer gets with this query is 460K.
We want to reduce it drastically.
SELECT temp21.resource_code
,temp21.employee_type employee_type
,temp21.resource_name resource_name
,temp21.manager_id
,temp21.manager_name
,temp21.period_start
,temp21.period_finish
,temp21.avail_hours
,temp21.act_hours
,temp21.timesheet_status timesheet_status
,temp21.email,temp21.ouc
,temp21.work_country
,f.level1_unit_id level1_id
,f.level2_unit_id level2_id
,f.level3_unit_id level3_id
,f.level4_unit_id level4_id
,f.level5_unit_id level5_id
,f.level6_unit_id level6_id
,f.level7_unit_id level7_id
,f.level8_unit_id level8_id
,f.level9_unit_id level9_id
,f.level10_unit_id level10_id
,f.level1_name
,f.level2_name
,f.level3_name
,f.level4_name
,f.level5_name
,f.level6_name
,f.level7_name
,f.level8_name
,f.level9_name
,f.level10_name
FROM (SELECT avail.res_id
,avail.resource_code
,avail.employee_type
,avail.person_type
,avail.resource_name
,avail.manager_id
,avail.manager_name
,avail.period_start
,avail.period_finish
,avail.avail_hours
,NVL(act.act_hours,0) act_hours
,act.timesheet_status
,avail.prid
,avail.email
,avail.ouc
,avail.work_country
FROM (SELECT /*+ALL_ROWS*/r.id res_id
,lk.name employee_type
,r.unique_name resource_code
,r.person_type
,r.first_name||' '||r.last_name resource_name
,r.manager_id manager_id
,r1.first_name||' '||r1.last_name manager_name
,TRUNC(tp.prstart) period_start
,TRUNC(tp.prfinish - 1) period_finish
,NVL(o.gs_hrs_avail_week,0) avail_hours
,r.email
,o.ouc
,o.work_country
,tp.prid
FROM niku.ODF_CA_RESOURCE o
,niku.SRM_RESOURCES r
,niku.SRM_RESOURCES r1
,niku.PRTIMEPERIOD tp
,niku.CMN_SEC_USER_GROUPS usr_grp
,niku.CMN_SEC_GROUPS grp
,(SELECT
NLS.NAME
,LKP.ID
FROM CMN_CAPTIONS_NLS NLS,CMN_LOOKUPS LKP
WHERE NLS.PK_ID=LKP.ID
AND LKP.LOOKUP_TYPE='SRM_RESOURCE_TYPE'
AND NLS.TABLE_NAME='CMN_LOOKUPS'
AND NLS.LANGUAGE_CODE='en') lk
WHERE r.id=o.id
AND r1.user_id(+)=r.manager_id
AND r.user_id=usr_grp.user_id
AND usr_grp.GROUP_ID=grp.id
AND r.person_type=lk.id
AND r.is_active = 1
AND r1.is_active = 1
AND grp.GROUP_CODE='gs_tb'
AND tp.prisopen = 1
) avail
,(SELECT r.id
,tp.prid
,SUM(NVL(practsum,0)/3600) act_hours
,ts.prstatus timesheet_status
FROM niku.SRM_RESOURCES r
,niku.PRTIMESHEET ts
SELECT /*+ALL_ROWS*/ MAX(prid) prid
,prtimeperiodid
,prresourceid
FROM niku.prtimesheet
GROUP BY prtimeperiodid,prresourceid
) ts_new
,niku.PRTIMEENTRY te
,niku.PRTIMEPERIOD tp
,niku.CMN_SEC_USER_GROUPS usr_grp
,niku.CMN_SEC_GROUPS grp
WHERE ts.prid=ts_new.prid
AND ts.prtimeperiodid=ts_new.prtimeperiodid
AND ts.prresourceid=ts_new.prresourceid
AND r.id=ts.PRRESOURCEID
AND ts.PRID=te.PRTIMESHEETID
AND ts.PRTIMEPERIODID=tp.prid
AND usr_grp.USER_ID=r.USER_ID
AND grp.id=usr_grp.group_id
AND r.is_active=1
AND tp.PRISOPEN=1
AND ts.prstatus not in(0,2,5)
AND grp.group_code='gs_tb'
AND TRUNC(tp.PRSTART) >= TRUNC(TO_DATE('7/24/2006','MM/DD/YYYY HH:MI:SS AM'))
AND TRUNC(tp.PRFINISH-1) <= TRUNC(TO_DATE('9/25/2006','MM/DD/YYYY HH:MI:SS AM'))
GROUP BY r.ID
,tp.PRID
,ts.prstatus) act
WHERE act.id(+) = avail.res_id
AND act.prid(+) = avail.prid
AND (avail.avail_hours - NVL(act.act_hours,0) > 0))temp21
,prj_obs_associations o1
,nbi_dim_obs f
WHERE 1=1
AND temp21.prid in (SELECT prid
FROM PRTIMEPERIOD
WHERE TRUNC(PRSTART) >= TRUNC(TO_DATE('7/24/2006','MM/DD/YYYY HH:MI:SS AM'))
AND TRUNC(PRFINISH-1) <= TRUNC(TO_DATE('9/25/2006','MM/DD/YYYY HH:MI:SS AM'))
AND
temp21.res_id = o1.record_id
AND o1.unit_id = f.obs_unit_id
AND o1.table_name = 'SRM_RESOURCES'
AND f.obs_type_id = 5000009
AND f.level5_unit_id = 5013334
ORDER BY temp21.manager_name
,temp21.manager_id
,temp21.resource_name
,temp21.resource_code
,temp21.period_start
,temp21.period_finish
,temp21.timesheet_status
...Also
AND TRUNC(tp.PRSTART) >= TRUNC(TO_DATE('7/24/2006','MM/DD/YYYY HH:MI:SS AM'))
AND TRUNC(tp.PRFINISH-1) <= TRUNC(TO_DATE('9/25/2006','MM/DD/YYYY HH:MI:SS AM'))Although this won't fail, you have specified the time portion of the date without supplying data to be converted....which you don't need as it will automatically be set to midnight if you don't specify it.
In addition, you are applying the TRUNC function to the column you are comparing which will prevent any indexes from being used. You should perform the arithmetic on the litterals, not the columns, and set up the range correctly:
AND tp.PRSTART >= TO_DATE('7/24/2006','MM/DD/YYYY)
AND tp.PRFINISH < TO_DATE('9/25/2006','MM/DD/YYYY) + 2This should yeild the same result and will allow any indexes to be used.
Without a formatted execution plan and more info from you, this is just a wild guess as to what part of the problem might be.
HTH
David
After a further look, the cartesian product appears to be in the bold section:
SELECT
temp21.resource_code
,temp21.employee_type employee_type
,temp21.resource_name resource_name
,temp21.manager_id
,temp21.manager_name
,temp21.period_start
,temp21.period_finish
,temp21.avail_hours
,temp21.act_hours
,temp21.timesheet_status timesheet_status
,temp21.email,temp21.ouc
,temp21.work_country
,f.level1_unit_id level1_id
,f.level2_unit_id level2_id
,f.level3_unit_id level3_id
,f.level4_unit_id level4_id
,f.level5_unit_id level5_id
,f.level6_unit_id level6_id
,f.level7_unit_id level7_id
,f.level8_unit_id level8_id
,f.level9_unit_id level9_id
,f.level10_unit_id level10_id
,f.level1_name
,f.level2_name
,f.level3_name
,f.level4_name
,f.level5_name
,f.level6_name
,f.level7_name
,f.level8_name
,f.level9_name
,f.level10_name
FROM ( SELECT
avail.res_id
,avail.resource_code
,avail.employee_type
,avail.person_type
,avail.resource_name
,avail.manager_id
,avail.manager_name
,avail.period_start
,avail.period_finish
,avail.avail_hours
,NVL(act.act_hours,0) act_hours
,act.timesheet_status
,avail.prid
,avail.email
,avail.ouc
,avail.work_country
FROM ( SELECT /*+ALL_ROWS*/
r.id res_id
,lk.name employee_type
,r.unique_name resource_code
,r.person_type
,r.first_name||' '||r.last_name resource_name
,r.manager_id manager_id
,r1.first_name||' '||r1.last_name manager_name
,TRUNC(tp.prstart) period_start
,TRUNC(tp.prfinish - 1) period_finish
,NVL(o.gs_hrs_avail_week,0) avail_hours
,r.email
,o.ouc
,o.work_country
,tp.prid
FROM
niku.ODF_CA_RESOURCE o
,niku.SRM_RESOURCES r
,niku.SRM_RESOURCES r1
,niku.PRTIMEPERIOD tp
,niku.CMN_SEC_USER_GROUPS usr_grp
,niku.CMN_SEC_GROUPS grp
,( SELECT
NLS.NAME
,LKP.ID
FROM
CMN_CAPTIONS_NLS NLS,
CMN_LOOKUPS LKP
WHERE
NLS.PK_ID=LKP.ID
AND LKP.LOOKUP_TYPE='SRM_RESOURCE_TYPE'
AND NLS.TABLE_NAME='CMN_LOOKUPS'
AND NLS.LANGUAGE_CODE='en'
) lk
WHERE r.id=o.id
AND r1.user_id(+)=r.manager_id
AND r.user_id=usr_grp.user_id
AND usr_grp.GROUP_ID=grp.id
AND r.person_type=lk.id
AND r.is_active = 1
AND r1.is_active = 1
AND grp.GROUP_CODE='gs_tb'
AND tp.prisopen = 1
) avail
,( SELECT
r.id
,tp.prid
,SUM(NVL(practsum,0)/3600) act_hours
,ts.prstatus timesheet_status
FROM
niku.SRM_RESOURCES r
,niku.PRTIMESHEET ts
,( SELECT /*+ALL_ROWS*/
MAX(prid) prid
,prtimeperiodid
,prresourceid
FROM
niku.prtimesheet
GROUP BY
prtimeperiodid,
prresourceid
) ts_new
,niku.PRTIMEENTRY te
,niku.PRTIMEPERIOD tp
,niku.CMN_SEC_USER_GROUPS usr_grp
,niku.CMN_SEC_GROUPS grp
WHERE
ts.prid=ts_new.prid
AND ts.prtimeperiodid=ts_new.prtimeperiodid
AND ts.prresourceid=ts_new.prresourceid
AND r.id=ts.PRRESOURCEID
AND ts.PRID=te.PRTIMESHEETID
AND ts.PRTIMEPERIODID=tp.prid
AND usr_grp.USER_ID=r.USER_ID
AND grp.id=usr_grp.group_id
AND r.is_active=1
AND tp.PRISOPEN=1
AND ts.prstatus not in(0,2,5)
AND grp.group_code='gs_tb'
AND TRUNC(tp.PRSTART) >= TRUNC(TO_DATE('7/24/2006','MM/DD/YYYY HH:MI:SS AM'))
AND TRUNC(tp.PRFINISH-1) <= TRUNC(TO_DATE('9/25/2006','MM/DD/YYYY HH:MI:SS AM'))
GROUP BY r.ID
,tp.PRID
,ts.prstatus
) act
WHERE act.id(+) = avail.res_id
AND act.prid(+) = avail.prid
AND (avail.avail_hours - NVL(act.act_hours,0) > 0)
)temp21
,prj_obs_associations o1
,nbi_dim_obs f
WHERE 1=1
AND temp21.prid in ( SELECT prid
FROM PRTIMEPERIOD
WHERE TRUNC(PRSTART) >= TRUNC(TO_DATE('7/24/2006','MM/DD/YYYY HH:MI:SS AM'))
AND TRUNC(PRFINISH-1) <= TRUNC(TO_DATE('9/25/2006','MM/DD/YYYY HH:MI:SS AM'))
AND
temp21.res_id = o1.record_id
AND o1.unit_id = f.obs_unit_id
AND o1.table_name = 'SRM_RESOURCES'
AND f.obs_type_id = 5000009
AND f.level5_unit_id = 5013334
ORDER BY temp21.manager_name
,temp21.manager_id
,temp21.resource_name
,temp21.resource_code
,temp21.period_start
,temp21.period_finish
,temp21.timesheet_status Message was edited by:
david_tyler
Similar Messages
-
Dear All,
My query is taking 575,618,610, executions 86,114 and CPU Time is 3982.59s which i found in the statspack report.
Then i checked the query to tune, but it's execution plan is showing only CPU cost 5.
So, what is the problem and what is the solution. Please let me know.
Thanks in advance
MahiHi Richard Foote,
The below is the function, in that i am using a cursor with the SQL in Bold letters.
That SQL query is taking more buffer gets as i expalined previously.
FUNCTION get_shortcuts(
p_org_id IN VARCHAR2,
p_usr_id IN VARCHAR2,
p_sws_id IN VARCHAR2,
p_lan_id IN VARCHAR2)
RETURN pglobal.g_ref_cur
AS
c_1 pglobal.g_ref_cur;
BEGIN
IF NVL(p_lan_id, 'ENG') = 'ENG' THEN
OPEN c_1
FOR
SELECT amnu.url_value, swssh.sws_id_1, sws.title
FROM SOFTWARE_SERVICE_SHORTCUTS swssh, SERVICE_PROVISIONS sp, SOFTWARE_SERVICES sws, APPLICATION_MENUS amnu
WHERE swssh.sws_id = p_sws_id
AND swssh.sws_id_1 = sp.sws_id
AND sp.rol_org_id = p_org_id
AND sp.sws_id = sws.id
AND sws.id = swssh.sws_id_1
AND sws.sws_id = amnu.sws_id
AND EXISTS(SELECT rol_id
FROM USER_ROLES
WHERE rol_org_id = p_org_id
AND usr_id = p_usr_id
AND rol_id = sp.rol_id); ELSE
OPEN c_1
FOR
SELECT sws.url_value, swssh.sws_id_1, sws.title
FROM SOFTWARE_SERVICE_SHORTCUTS swssh,
SERVICE_PROVISIONS sp,
SOFTWARE_SERVICES sws,
SOFTWARE_SERVICE_LANGUAGES swsl
WHERE swssh.sws_id = p_sws_id
AND swssh.sws_id_1 = sp.sws_id
AND swsl.sws_id = sws.id
AND swsl.lan_id = p_lan_id
AND sp.rol_id = p_org_id
AND sp.sws_id = sws.id
AND EXISTS(SELECT rol_id
FROM USER_ROLES
WHERE rol_org_id = p_org_id
AND usr_id = p_usr_id
AND rol_id = sp.rol_id)
GROUP BY sws.url_value, swssh.sws_id_1, sws.title;
END IF;
RETURN c_1;
END;
So, please can u explain me is there any possiblity to reduce the buffer gets after checking the above function.
Thanks in advance
Mahi -
Help...i keep getting the following error message...
anyone out there can offer some assistance? the following error message only appears almost towards the end of the burning process:
"The recording device reported the not ready error: Cannot write medium – incompatible format. (0x30, 0x05.)"
Here's what i've done so far:
1. I've removed all attached peripherals and initiated a Apple Hardware Test - no errors detected BUT when i tried the burning process on iDVD - same thing happened!
2. I then purchased a CD ROM cleaner. Listened to the horrible elevator music and tried it again - nothing. Well, nothing new - same error message!
3. Question is - is my Superdrive faulty? Or is it a software issue with iDVD? Do i need to download an update or something?
Thanks for reading this and offering your assistance
PowerMac G5 Mac OS X (10.4.8) NAI have had problems with Sony disks. The most recommended here are Verbatim 8x DVD-R burned at 4x or even 2x (slower burn = better burn).
I also get consistent success with Fuji disks.
It doesn't matter that your disks are 16x, just burn them at a slower rate.
BTW, if your disks are '4.7GB' they a single layer. -
I am getting the following error message "wireless network appears to have been compromised"
I am getting the following error message "wireless network appears to have been compromised"
Any information would be helpful.bclark173 wrote:
I am getting the following error message "wireless network appears to have been compromised"
Can you provide a screenshot of this message? Make a screenshot by following the directions here:
http://support.apple.com/kb/HT5775
Be sure no sensitive personal information is displayed. To add that image to a post here, click the camera icon in the post editor toolbar. -
Hi I am trying to uninstall a previous version of itunes or download a newer version and I get the following error message "The feature you are trying to use is on a network resource that is unavailable" can anyone help please?
(1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page).
http://majorgeeks.com/download.php?det=4459
Here's a screenshot showing the particular links on the page that you should be clicking:
After clicking one of the circled links, you should be taken to another page, and after a few seconds you should see a download dialog appear for the msicuu2.exe file. Here's a screenshot of what it looks like for me in Firefox:
Choose to Save the file. If the dialog box does not appear for you, click the link on the page that says "CLICK HERE IF IT DOES NOT". Here's a screenshot of the page with the relevant link circled:
When the dialog appears, choose to save the file.
(2) Go to the Downloads area for your Web browser. Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
(3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
(4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
(5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time? -
I have three aperture libraries. But just recently two of them (old from 2011) will not open. I get the following error: There was an error opening the database for the library “~/Pictures/Family IIi.aplibrary”. Please help, thanks
Are all three libraries under your account or are they in different accounts? Any other errros on the system?
Start by doing the permission repair and library repair steps in Aperture 3: Troubleshooting Basics -
When trying to verify the email address, I get the following message. Please help. This email address is already in use or you may already have an Apple ID associated with this email address. Please try again or sign in using your existing Apple ID.
Me too. I try to verify and i get the same message.
I've created 3 alternate e-mail addresses and tried creating new accounts.
Same Result!
This is bullsh!t. How the **** can all 4 of my attempts result in the same freakin error??? -
I am having a problem when I plug my iPod into my macbook. When I plug the cable into my mac I get the following message - "Because a USB device was drawing too much power from your computer, your USB device has been disabled." CAN SOMEONE PLEASE HELP!
The rest of the message in the pop up window says "To prevent damaging your computer, the USB device drawing too much power has been disabled. Other devices may have also been disabled. When you disconnect the device drawing too much power, your other USB devices will be enabled again."
-
Hi All,
I am new to this forumm
I am running a job in control m Server...While runnig the job I am getting the following error.... Please help me to sort out this issue...
err_mess=old 524: record_date := to_date('&1','YYYYMMDD');
new 524: record_date := to_date('20090411','YYYYMMDD');
rmis_org_load.update_org_lookup ( org_id,
ERROR at line 928:
ORA-06550: line 928, column 2:
PLS-00306: wrong number or types of arguments in call to 'UPDATE_ORG_LOOKUP'
ORA-06550: line 928, column 2:
PL/SQL: Statement ignored
ORA-06550: line 999, column 2:
PLS-00306: wrong number or types of arguments in call to 'UPDATE_ORG_LOOKUP'
ORA-06550: line 999, column 2:
PL/SQL: Statement ignored
ORA-06550: line 1040, column 2:
PLS-00306: wrong number or types of arguments in call to 'UPDATE_ORG_LOOKUP'
ORA-06550: line 1040, column 2:
PL/SQL: Statement ignored
+ [ 1 -ne 0 ]
+ print RMOG0003 Error during rmog0003.ins .\n\n Error message : old 524: record_date := to_date('&1','YYYYMMDD');
new 524: record_date := to_date('20090411','YYYYMMDD');
rmis_org_load.update_org_lookup ( org_id,
ERROR at line 928:
Let me know If you have the answer
Edited by: user2708250 on May 21, 2009 10:34 PMHi, you're calling the prodedure with the wrong parameters.
You can check by f.i:
SQL> desc rmis_org_load
what parameters the procedure needs and in what order. -
The latest version of iTunes did not install properly on my Windows 7-64bit PC. I am getting the following error message: "Service 'Apple Mobile Device' failed to start. Verify that you have sufficient privileges to start system services."
I have tried the following troubleshooting steps without success:
Restart PC
Uninstall iTunes and attempt to reinstall
Verify that I am signed in as an administrator
Download and save iTunes64Setup file, right-click, and run as Administrator
Disable Norton antivirus software
Any suggestions would be greatly appreciated!Hi Iss9243,
Welcome to the Support Communities!
You've already tried some great troubleshooting steps, but the article below gives you quite a few more for this issue. Hope it helps ....
iTunes 11.1.4 for Windows: Unable to install or open
http://support.apple.com/kb/TS5376
Cheers,
- Judy -
I am trying to download Firefox on my laptop which runs Vista. I am getting the following error message: Your Firefox profile can't be loaded, it may be missing or innaccessible." Please help.
See:
* http://kb.mozillazine.org/Recovering_a_missing_profile
* http://kb.mozillazine.org/Profile_in_use
* https://support.mozilla.com/kb/Firefox+is+already+running+but+is+not+responding -
i am getting the following error message while opening the fire fox browser "sript file:///programe % 20 files/siber%AT% 20roboform/Firefox/components/ref helper.JS:510 in English
ls -l /var/run/lighttpd/
And how are you spawning the php instances? I don't see that in the daemons array anywhere.
EDIT: It looks like the info in that page is no longer using pre-spawned instances, but lighttpd adaptive-spawn. The documentation has been made inconsistent it looks like.
You will note that with pre-spawned information, the config looks different[1].
You need to do one or the other, not both (eg. choose adaptive-spawn, or pre-spawn..not both).
[1]: http://wiki.archlinux.org/index.php?tit … oldid=8051 "change" -
When I start iTunes I get the following message. "A required iTunes component is not installed. Please repair or reinstall iTunes (-42404)". I have installed the latest version of iTunes but still get this message. Can anyone help?
Hello mustangcim243,
iTunes has various components bundled with it that it requires for general usage. I advise that we completely remove iTunes and all of these related components, verify that they have been removed, then reinstall. To do so, please follow the steps in this article:
Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7
http://support.apple.com/kb/HT1923
Note: it is important to remove the 7 components in order. Uninstalling these components in a different order, or only uninstalling some of these components may have unintended affects.
If the above does not resolve your issue, I recommend we reset the SC Info folder:
iTunes repeatedly prompts to authorize computer to play iTunes Store purchases
http://support.apple.com/kb/TS1389
(See Step 4: Remove the SC Info folder)
Thanks,
Matt M. -
I keep getting the following message:
Runtime Error...Microsoft Visual C++ Runtime Library Program C:\Program Files\iTunes\iTunes.exe
R6034 An application has made an attempt to load the C runtime library incorrectly and can't open iTunes now.
Please could someone help with this query as I am at a loss as to why this problem is now occurring? Thank you.Check the user tip below.
https://discussions.apple.com/docs/DOC-6562 -
I'm trying to re-install I-Tunes on my Windows 7 computer. I get the following error message: Service "Apple Mobile Device" failed to start. Verify that you have sufficient privileges to start system services. HELP?
Did you try to update iTunes through "Apple Software Update"?
Uninstall everything {iTunes, Apple Software Update, Apple Mobile Device Support, Bonjour , Apple Application Support (iTunes 9 or later)}
http://support.apple.com/kb/ht1923
then reinstall itunes. (Download it from Apple's site.)
Maybe you are looking for
-
FRM-18108 Error when opening a form with subclassed objects
Dear Group, I have 2 forms in Oracle Forms 6i. One of the forms contains an object group. The other form contains the object that I subclassed it to. When I open the form that contains the subclassed object group, I get the FRM-18108 error. If I open
-
Problems after force reboot. Hard disk problems
Yesterday, I ran a c program on my work station. And, the program have some big out puts, files with size 2G,7G. And then the disk was filled. Then some problem happened. When rebooting it shows something like: INIT: cannot execute "/sbin/agetty" INI
-
How to calculate Sub-Totals/Grand Totals on repeating row.
I have a this form that I need to calculate to produce a Sub-Total.... An end user can keep adding a line item but I would like to be able to add the amounts entered to calculate in a sub-total field. So basically, I need help with the actual scrip
-
Insufficient credit on an unlimited subscription
I have just bought the unlimited subscription and can not make a call at all. It keeps tellin me I have insufficient credit.. On an unlimited subscription.. How does that work? I did have to buy more credit because I needed to make phone calls, but m
-
Compressed tables with more than 255 columns
hi, Would anyone have a sql to find out compressed tables with more than 255 columns. Thank you Jonu