| | Performance, Scalability and HA Optimizing the performance of OTM / G-Log, configuring Scalability (SCA) and maintaining High Availability. |  | 
March 14th, 2008, 21:25
| | Junior Member | | Join Date: Mar 2007
Posts: 20
Thanks: 4
Thanked 0 Times in 0 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
Rep Power: 0 | | | UTC.GET_LOCAL_DATE SQL Performance We are using utc.get_local_date function very frequently. Is there a better way to get the local date? This function call is taking a long time execute.
For example.
to_char(ORD.LATE_PICKUP_DATE,'DD-MON-YYYY') = '14-MAR-2008' (ORD is order release)
This condition in the where clause scans through all the rows in the order release ID.
How can I avoid the complete table scan?
Thanks,
Prasad.
__________________ Thanks,
Prasad. | 
March 15th, 2008, 09:53
| | Member | | Join Date: Mar 2007 Location: Bedfordshire England
Posts: 48
Thanks: 3
Thanked 9 Times in 8 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
Rep Power: 0 | | | Re: UTC.GET_LOCAL_DATE SQL Performance prasad
Its not the utc.get_local_date that is causing the full table scan - its the query.
If you look for a particular date in the Order_release table, it will scan all entries unless you add an index on the field being searched.
Adding further filtering criteria would help reduce the number of records to scan (if available).
Cheers
Gary  | | The Following User Says Thank You to cunninghamg For This Useful Post: | | 
March 15th, 2008, 21:40
|  | Site Moderator | | Join Date: Jun 2006 Location: West Chester, PA
Posts: 816
Thanks: 53
Thanked 199 Times in 121 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
Rep Power: 10 | | | Re: UTC.GET_LOCAL_DATE SQL Performance I definitely agree with Gary on this one. All queries in the system should be qualified with additional criteria (especially date criteria) in order to avoid full table scans. Many times the screens are modified, so that a date criteria is automatically includes, such as only returning results within the last 60 or 90 days.
--Chris | 
March 16th, 2008, 22:16
| | Junior Member | | Join Date: Mar 2007
Posts: 20
Thanks: 4
Thanked 0 Times in 0 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
Rep Power: 0 | | | Re: UTC.GET_LOCAL_DATE SQL Performance Gary & Chris.
Thank You for you hint. By narrowing the query, the performance increased significantly.
regards,
Prasad.
__________________ Thanks,
Prasad. | 
June 5th, 2008, 22:26
| | Member | | Join Date: May 2007 Location: India
Posts: 69
Thanks: 1
Thanked 2 Times in 2 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
Rep Power: 2 | | | Re: UTC.GET_LOCAL_DATE SQL Performance Hi Chris,
We recently migrated our Devl environment from 4.5 to 5.5 CU#4 RU#1.
We could find when we run the the sql statement on migrated 5.5 Database
select UTC.GET_LOCAL_DATE (SYSDATE, NULL) from dual; throws an exception "ORA-20000: Undefined time zone for location".
However this same used to run on 4.5 Database. Now we have a bunch of reports which uses this function and all those reports are now throwing this exception. We do have raised a SR with Oracle on this, however still research is going on.
I will keep you update on this on receipt of a workaround.
Regards,
Suresh | | The Following User Says Thank You to sknmail@rediffmail.com For This Useful Post: | | 
June 5th, 2008, 23:59
|  | Site Moderator | | Join Date: Jun 2006 Location: West Chester, PA
Posts: 816
Thanks: 53
Thanked 199 Times in 121 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
Rep Power: 10 | | | Re: UTC.GET_LOCAL_DATE SQL Performance Suresh,
Thank you. I haven't run into this issue myself, but will shop it around some of my contacts to see if I can help find a solution. Otherwise, I appreciate you keeping us updated.
--Chris | 
June 6th, 2008, 09:02
| | Member | | Join Date: Mar 2007 Location: Bedfordshire England
Posts: 48
Thanks: 3
Thanked 9 Times in 8 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
Rep Power: 0 | | | Re: UTC.GET_LOCAL_DATE SQL Performance Hi
So far as I recall the utc.get_local_date function is used to determine the timezone of the Location being passed in.
In you case - no location is being passed in - hence the error.
Did you expect this function to use your local PC timezone setting?
If so - I don't see this is possible.
Gary  | 
June 6th, 2008, 13:55
| | Junior Member | | Join Date: Dec 2006
Posts: 17
Thanks: 1
Thanked 2 Times in 2 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
Rep Power: 0 | | Re: UTC.GET_LOCAL_DATE SQL Performance The reason you are getting is error is that Oracle have modified the UTC package.
Prior to 55, the piece of code was coded as
if ( v_time_zone_gid is null) then
return local_date;
end if;
where local_date returned the system date from the database server. Whereas in 55 the above piece of code has been modified as
if ( v_time_zone_gid is null) then
raise_application_error(-20000, 'Undefined time zone for location'|| v_location_gid);
end if;
Thus making it mandatory to pass a location gid to get the local date from the server. A simple workaround to get this working without modifiying any of your reports would be to add a location with LOCATION_GID value as 'NULL' and the TIME_ZONE_GID with a value of your local timezone.
Alternatively, you can also use the below query to get local date in GMT.
select vpd.gmt_sysdate from dual
Please update if this works or I will suggest a few other options.
Regards,
Prabhakar |  | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | |
Similar Threads | | Thread | Thread Starter | Forum | Replies | Last Post | | Performance Benchmarks | ashwinrrao | Performance, Scalability and HA | 7 | January 21st, 2008 13:12 | | OTM 5.5: VPD Query Performance - Improvements | ianlo | Performance, Scalability and HA | 10 | December 4th, 2007 00:24 | | Performance issue integration | bob_romijn | Performance, Scalability and HA | 5 | November 28th, 2007 11:11 | | Rational Performance Tester | Kristof Stevens | Performance, Scalability and HA | 1 | September 10th, 2007 09:07 | | Optimizing GC3 v5.0 Performance - Part 1 | chrisplough | Performance, Scalability and HA | 6 | August 30th, 2007 18:57 | |