Home » RDBMS Server » Performance Tuning » Sql Taking More CPU time (merged) (Oracle 10g ,Sun Solaris)
Sql Taking More CPU time (merged) [message #483598] Tue, 23 November 2010 06:47 Go to next message
saiphani723
Messages: 38
Registered: July 2006
Location: Hyderabad
Member
Hi all,
I have one query in my production which is taking more CPU time. when that statement executing the CUP is taking more than 90%
I am attaching the sql query and indexes on the table.
Can anyone tell me how to solve this.
  • Attachment: Sql_Index.sql
    (Size: 1.41KB, Downloaded 1192 times)
Re: Sql Taking More CPU time (merged) [message #483601 is a reply to message #483598] Tue, 23 November 2010 07:18 Go to previous messageGo to next message
Michel Cadot
Messages: 68647
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Read http://www.orafaq.com/forum/mv/msg/84315/433888/102589/#msg_433888 and post the required information.

Regards
Michel
Re: Sql Taking More CPU time (merged) [message #483658 is a reply to message #483598] Wed, 24 November 2010 00:33 Go to previous messageGo to next message
michael_bialik
Messages: 621
Registered: July 2006
Senior Member
Can you use 2 different SQL statements ?

Select 	Nvl(Sum(DeCode(TransCode,'59',NetPremium,(-1)*NetPremium)),0) NetPremium
		From	Central_Repository
		Where	CompanyCode 	=	PCompanyCode
		And	InsuranceType	=	PInsuranceType
		And	ProposerCode	=	PProposerCode
		And	RefNo		=	PReferenceNo
		And	TransCode	In	('19','59')
		And	TransDate	<=	PToDate;


Select 	Nvl(Sum(DeCode(TransCode,'59',NetPremium,(-1)*NetPremium)),0) NetPremium
		From	Central_Repository
		Where	CompanyCode 	=	PCompanyCode
		And	InsuranceType	=	PInsuranceType
		And	ProposerCode	=	PProposerCode
		And	TransCode	In	('19','59')
		And	TransDate	<=	PToDate;


How many rows do you have?
How many distinct values for CompanyCode, InsuranceType,
ProposerCode, RefNo, TransCode and TransDate columns exist?
Re: Sql Taking More CPU time (merged) [message #483663 is a reply to message #483658] Wed, 24 November 2010 00:38 Go to previous messageGo to next message
saiphani723
Messages: 38
Registered: July 2006
Location: Hyderabad
Member
Thank you for your reply.

I will try using two statements and i will get back to you.
For company code and Insurance type there will be only one value across the table. But remaining columns there were many values.

Re: Sql Taking More CPU time (merged) [message #483664 is a reply to message #483663] Wed, 24 November 2010 00:50 Go to previous message
michael_bialik
Messages: 621
Registered: July 2006
Senior Member
So - remove both these columns from all indexes as they can NOT be used to filter any rows.
Previous Topic: Performance tuning (cache sub query results)
Next Topic: Improve performance of create statements on a highly fragmented disk
Goto Forum:
  


Current Time: Sat Apr 27 09:22:20 CDT 2024