Who's Online
0 registered (), 11 Guests and 5 Spiders online.
Key: Admin, Global Mod, Mod
Recent Posts
Interfacing iRec and external sites
by DanC
Yesterday at 11:42 PM
Time and Labour & Oracle Projects
by Paul
Yesterday at 07:34 PM
End of Year Legislation Patch for 11i
by delboy
Yesterday at 02:00 PM
Search Engine Optimizers
by delboy
Yesterday at 01:30 PM
Abseces in oracle hrms, super user: how to do I:
by JayTee
Yesterday at 07:26 AM
Update EIT in SSHR
by Mr Oracle
08/02/12 01:50 PM
Function for getting retropay-maintained balances
by CT
08/02/12 12:21 PM
Grade End Date
by Chris
03/02/12 10:46 AM
OLM Mandatory Enrolments
by bcooper
01/02/12 12:23 PM
Retro-Notifs Report missing some ele entries
by CT
01/02/12 06:51 AM
Top Posters (30 Days)
CT 27
delboy 25
bcooper 14
Gus 5
paulgos 5
Sahir 4
tovia123 4
SBi 3
MichaelWest 3
Simon_Mc 3
(Views)Popular Topics
Family Pack K issues thread 18194
CREATE_GRADE api returns:PLS-00306: wrong number o 13736
Still trying to locate... 12185
Creating hr jobs ORA-20001: HR_289477_JOB_GROUP_ID 10634
Viewing Output of another user 9123
HR_PF.K RUP4 8816
Review of my Release 12 laptop 8485
Adding a taskflow button to a form 7842
Enhanced Retro & Release 12 7661
Family Pack K 7102
Topic Options
Rate This Topic
#1266 - 04/04/05 09:15 AM optimizer hints
mgereis Offline
regular

Registered: 30/03/05
Posts: 26
Loc: Reading, UK
ok i've heard this term over and over again and i don't know what it's about! what are these hints? and how do you stick em in a reports query or a form sql block!! .and is the myth true? does it really make a performance difference? .if anyone has more info please patch it through. hmmm maybe i shouldn't use the term "patch" it might irritate a few overworked techies or in other words patchophobics! :lol:
_________________________
Mina Gereis

Top
#1267 - 04/04/05 10:20 AM Re: optimizer hints
bcooper Offline

Guru
*****

Registered: 11/03/05
Posts: 1094
Loc: Earth, Europe, England, here
Hints are added to SQL (in the main). . .You put them in the SELECT statement eg . .SELECT /*+ FIRST_ROWS(1) */ <select item list> . .HOWEVER you need to know what you are doing first. . .I would suggest taking a look at the ORacle Performance Tuning Guide first especially if you are totally new to this. . .In the wrong hands you can wreak havoc by poor or incorrect use of optimiser hints. .Trust me i know from experience how easy it is to get things wrong.
_________________________
HCM Aces is for sale! Please contact me if you are interested.
Also my random musings courtesy of Twitter

Top
#1268 - 04/04/05 12:00 PM Re: optimizer hints
CT Offline
Guru
***

Registered: 11/03/05
Posts: 1080
Loc: Bath
[quote:ad59da7f24]In the wrong hands you can wreak havoc by poor or incorrect use of optimiser hints. .Trust me i know from experience how easy it is to get things wrong.[/quote:ad59da7f24] . .So do several clients :lol: . .A point perhaps worth remembering is that most of the time the Cost-Based optimiser will do a lot of the figuring out for you provided you give it some reasonably up-to-date stats to work on. Eg a common problem encountered during datamigration excercises (particularly into new database instances) is that after the first couple of entities eg person/assignment thereafter performance starts to dip. This is usually because the stats process hasn't been run to update the stats on the affected tables. There is a standard process helpfully entitled 'Gather Schema Stats' within the SYSADMIN responsiblity that will address this problem. As Mr Brookes will doubtless attest it is possible to run this whilst a migration program is running and may even result in a noticeable improvement in throughput once complete.
_________________________
L&K
CT

Remember: A dog is for life, not just for Christmas... unless you're in Korea

Top
#1269 - 04/04/05 12:15 PM Re: optimizer hints
mgereis Offline
regular

Registered: 30/03/05
Posts: 26
Loc: Reading, UK
ok.. so is it possible to optimize this SQL: . . SELECT . POV.vendor_name . POV.employee_id . A.assignment_id . POV.vendor_id . A.business_group_id . A.assignment_number . max(APC.check_date) effective_date . INV.invoice_num . INVD.distribution_line_number . INVD.description expense_item . L.DESCRIPTION pay_element_name . INVD.amount . . FROM . PO_VENDORS POV . AP_CHECKS_ALL APC . AP_INVOICES_ALL INV . AP_INVOICE_DISTRIBUTIONS_ALL INVD . per_all_assignments_f A . AP_LOOKUP_CODES L . . WHERE POV.vendor_id = APC.vendor_id . AND POV.vendor_id = INV.vendor_id . AND INV.invoice_id = INVD.invoice_id . AND POV.Employee_Id = A.Person_Id . AND UPPER(INVD.Description) = L.LOOKUP_CODE . AND POV.employee_id is not null . AND NVL(invd.amount 0) <> 0 . AND INVD.description like 'TAX%' . AND L.lookup_type = 'DWP_OIE_ELEMENT_MAPPING' . GROUP BY . POV.vendor_name . POV.employee_id . A.assignment_id . A.assignment_number . POV.vendor_id . A.business_group_id . INV.invoice_num . INVD.distribution_line_number . INVD.description . L.DESCRIPTION . INVD.amount;
_________________________
Mina Gereis

Top
#1270 - 04/04/05 12:25 PM Re: optimizer hints
CT Offline
Guru
***

Registered: 11/03/05
Posts: 1080
Loc: Bath
Dunno why but that 'GROUP BY' makes me nervous...
_________________________
L&K
CT

Remember: A dog is for life, not just for Christmas... unless you're in Korea

Top
#1271 - 04/04/05 12:33 PM Re: optimizer hints
mgereis Offline
regular

Registered: 30/03/05
Posts: 26
Loc: Reading, UK
what's wrong with it? .i'm using MAX so the statement has to have a group by! .so how can i make it better? this sql inserts rows into a staging table. the whole thing is part of a procedure (package). .help!! :?
_________________________
Mina Gereis

Top
#1272 - 04/04/05 08:14 PM Re: optimizer hints
CT Offline
Guru
***

Registered: 11/03/05
Posts: 1080
Loc: Bath
Ok to me 'GROUP BY' suggests 'SORT-MERGE' on x-teen tables some of which will be potentially large. There may be a way to break that 'MAX' function out into an inline view of some sort (cue some 9i expert...). Another couple of issues spring to mind: . .1. I assume you're in a shared-HR install - eg purchasing/payables possibly iexpenses. If not (in fact even if it is) may I suggest you put some sort of date limitation on the assignments table eg . ....and trunc(sysdate) between a.effective_start_date and a.effective_end_date . .At least then all hell won't break loose on this query if and when your client friends do take the full HR product and you're facing the prospect of multiple assigment records because of the wonderful date-track... . .2. Since you're joining POV.employee_id to a.person_id (which is a not null column) then having 'AND POV.employee_id IS NOT NULL' doesn't really add anything. ie you could remove it . .3. The NVL function in 'AND NVL(invd.amount 0) <> 0' doesn't do much - it would ignore nulls anyway which by the looks of it is what you want. . .So with all of that in mind here's my (totally untested undocumented just like I was still at the Big O) stab at what you're after: . .NB Get a sysadmin bod to do a Gather Schema Stats ('ALL') first just to rule that out of the equation... . .SELECT .POV.vendor_name .POV.employee_id .A.assignment_id .POV.vendor_id .A.business_group_id .A.assignment_number .APC.check_date effective_date .INV.invoice_num .INVD.distribution_line_number .INVD.description expense_item .L.DESCRIPTION pay_element_name .INVD.amount .FROM .PO_VENDORS POV .AP_CHECKS_ALL APC .AP_INVOICES_ALL INV .AP_INVOICE_DISTRIBUTIONS_ALL INVD .per_all_assignments_f A .AP_LOOKUP_CODES L .WHERE POV.vendor_id = APC.vendor_id .AND POV.vendor_id = INV.vendor_id .AND INV.invoice_id = INVD.invoice_id .AND POV.Employee_Id = A.Person_Id .AND UPPER(INVD.Description) = L.LOOKUP_CODE .--AND POV.employee_id is not null .--AND NVL(invd.amount 0) <> 0 .AND invd.amount <> 0 .AND INVD.description like 'TAX%' .AND L.lookup_type = 'DWP_OIE_ELEMENT_MAPPING' .AND APC.CHECK_DATE = . (SELECT MAX (APC2.CHECK_DATE) . FROM AP_CHECKS_ALL APC2 . WHERE APC2.VENDOR_ID = APC.VENDOR_ID . ) .; . .PS The usual disclaimers apply! If it works then I'm happy to have helped 8) - if it made things worse (eg street-lights flickering outside whilst running it) then Brookes wrote it. :roll: . .Good luck!
_________________________
L&K
CT

Remember: A dog is for life, not just for Christmas... unless you're in Korea

Top
#1273 - 05/04/05 06:54 AM Re: optimizer hints
bcooper Offline

Guru
*****

Registered: 11/03/05
Posts: 1094
Loc: Earth, Europe, England, here
A straight explain of the statement on my system (having no knowledge of the size of your tables etc) gives... . .SELECT STATEMENT CHOOSE . SORT(GROUP BY) . TABLE ACCESS(BY INDEX ROWID) APPLSYS.FND_LOOKUP_VALUES . NESTED LOOPS . NESTED LOOPS . NESTED LOOPS . NESTED LOOPS . NESTED LOOPS . TABLE ACCESS(BY INDEX ROWID) PO.PO_VENDORS . INDEX(FULL SCAN) PO.PO_VENDORS_N1 . TABLE ACCESS(BY INDEX ROWID) AP.AP_CHECKS_ALL . INDEX(RANGE SCAN) AP.AP_CHECKS_N6 . TABLE ACCESS(BY INDEX ROWID) AP.AP_INVOICES_ALL . INDEX(RANGE SCAN) AP.AP_INVOICES_N2 . TABLE ACCESS(BY INDEX ROWID) HR.PER_ALL_ASSIGNMENTS_F . INDEX(RANGE SCAN) HR.PER_ASSIGNMENTS_F_N12 . TABLE ACCESS(BY INDEX ROWID) AP.AP_INVOICE_DISTRIBUTIONS_ALL . INDEX(RANGE SCAN) AP.AP_INVOICE_DISTRIBUTIONS_U1 .INDEX(RANGE SCAN) APPLSYS.FND_LOOKUP_VALUES_U1 . .First port of call is to try and remove the full scan on the non-unque N1 index of PO_VENDORS. .Failing that break out the Max(apc.check_date) to a function call or a correlated sub-query to pass back the row with the max date. . .As you can see trying to tune a statement with no prior knowledge as to what it is trying to achieve is almost impossible. .I as an impartial observer would want to question why you are bringing back half the data items you have in the select list and inquire as to the purpose of the statement.
_________________________
HCM Aces is for sale! Please contact me if you are interested.
Also my random musings courtesy of Twitter

Top



Moderator:  bcooper, CT 
Forum Stats
755 Members
48 Forums
1516 Topics
7282 Posts

Max Online: 63 @ 24/11/10 07:21 AM
Today's Birthdays
No Birthdays
Recent vacancies
Tea boy available 4 basic chores & some! services
by Simon_Mc
19/01/12 03:59 PM
Top Posters
bcooper 1094
CT 1080
delboy 499
Geoff Dixon 369
SBi 344
vkumar 223
kp_rapolu 213
cbrookes 197
Gavin Harris 160
Gus 132
February
Su M Tu W Th F Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29