Question on Performance of a Stored Package. [message #38394] |
Tue, 16 April 2002 08:57 |
Vidyalakshmi Iyer
Messages: 13 Registered: April 2002
|
Junior Member |
|
|
Hi,
We have a stored package which opens a cursor for update (about 60,000 - 75,000 records )
then a lot of processing is done on these records.
Each record is fetched inside a loop and then
They are rated taking the rates from various table. for which cursors are opened and closed inside the loop.
these tables from where these rates are taken are also pretty huge about 80,000-90,000 records.
at the end of the loop the table is updated with processed fields with the where current of clause.
Now I have a problem that this entire process of processing about 75000 records takes me about 6-7 hours.
This is surely not what we want.
We have only 2 processors.
Oracle 9i
Sun Solaris Unix - 5.8
What are the ways you suggest in which we could improve the speed.
Thanking you,
Regards,
Vidya.
|
|
|
Re: Question on Performance of a Stored Package. [message #38395 is a reply to message #38394] |
Tue, 16 April 2002 09:14 |
|
Mahesh Rajendran
Messages: 10707 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
we have implemented certain batch jobs, which handle a few million records. based on that, i would recomend the following.
1. use pl/sql tables for lookup purpose in the procedure.
2. commit data in-frequently.
3.if possible move the concerned tablespaces to a different contention free disk.
4. Avoid using any like or % operators in the cursor definition.
5. make use of the unix pipes so that many copies of the same procedure can be run in parallel.
6. in case of 9i turn the logging options for the tablespace off (oracle does not recomend it,though it is faster for updates) so no logs are generated.
7. Analyze the disk RPM, available swap (min is 3 x ram) and other temporary memory management. ( if you use sorts,order by etc, increase the temp segment...etc).
[Updated on: Tue, 12 May 2009 11:02] Report message to a moderator
|
|
|
|
Re: Question on Performance of a Stored Package. [message #38422 is a reply to message #38395] |
Wed, 17 April 2002 06:52 |
Vidyalakshmi Iyer
Messages: 13 Registered: April 2002
|
Junior Member |
|
|
Hi,
Thanks Mahesh For your suggestions.. I implemented the part which commits after 2000 records and it reduced the time from 7 hours to 4 hours ..
we are still working on it..have to get it to do in about 2 hours..or less..if possible..
i am still working on your other suggestions..
will keep you posted.
Thanks again,
Vidya
|
|
|
|
|
Re: Question on Performance of a Stored Package. [message #38437 is a reply to message #38395] |
Wed, 17 April 2002 14:39 |
Vidyalakshmi Iyer
Messages: 13 Registered: April 2002
|
Junior Member |
|
|
Hi Mahesh,
Thanks so much for your time.
but this is the problem I have...
the cursor definition goes like this..
Cursor v is
Select name from emp
where
id = Substr( :vid, 1, Length(id) )
order by id desc ;
and the value of vid changes changes in
every iteration of the loop
this cursor fetches many records but we need just the first one that it fetches..that is why the order by.
the table emp is huge ..about 50,000-60,000 records.
yes, we do a full table scan in this cursor.
so if i use a pl/sql table I will have to load the entire table emp (name & id fields only) in the pl/sql table and then for each value of vid go through the pl/sql table instead of emp table.. will that be faster?
if yes,I shall go ahead and do that.
Regards,
Vidya.
|
|
|
|
|
|
Re: Question on Performance of a Stored Package. [message #38496 is a reply to message #38395] |
Mon, 22 April 2002 23:33 |
jack
Messages: 123 Registered: September 2000
|
Senior Member |
|
|
I think I understand what you are trying to do. Here is an approach to think about.
Load the emp table into a index-by table, using the emp.id as the index. index-by tables are sparse so you will only use memory for indexes that are created.
To get a best match: start with the full vid and see if an entry in the index-by table exists at that vid (use the vid as in index). If it does not, remove the end character from the vid and see if that vid index exists. Repeat until the vid is 0 length or found.
Now, I *THINK* this should be more effective then the cursor approach. You'll need one full table scan to load the emp table into the index-by table. The lookups to get a vid match will be *very fast* since the vid is a direct index into the table, although there will be a few wasted lookups until a best match is found.
|
|
|