Home » RDBMS Server » Performance Tuning » Change in explain plan due to Oracle upgrade (Oracle 10.2.0.4.0, Windows Server 2003)
Change in explain plan due to Oracle upgrade [message #486150] Tue, 14 December 2010 00:12 Go to next message
chowdhhx
Messages: 2
Registered: December 2010
Location: Sydney, Australia
Junior Member
Hi everyone. First post here, which I'm quite excited about. Also, I need to warn readers that I am not a DBA but am heavily involved in application development. Whatever I know about database tuning is whatever I've managed to pick up via self-learning, and I must admit that the sum total of my knowledge isn't a lot.

Anyway, our "DBAs" recently did an upgrade to our 10g database, going from version 10.2.0.2.0 to 10.2.0.4.0. Immediately after the upgrade, a particular query has started to under-perform. The query itself was not altered in any way during the upgrade.

We have two explain plans for the query, a before and an after plan. The two plans are similar but not identical. The plans are too massive to post here, so I hope the following synopsis of the differences will do.

The 10.2.0.2.0 plan:


  • shows a HASH GROUP BY
  • has a TempSpc column in the explain plan
  • shows a particular table (EMP_HISTORY) as having ~1700 rows


The 10.2.0.4.0 plan:


  • shows SORT GROUP BY instead of HASH GROUP BY
  • does not show a TempSpc column in the explain plan
  • shows the EMP_HISTORY table as having only 25 rows


Other than these points, no other discernible differences can be noted. I'm wondering what would cause HASH to change to SORT. I'm told that stats are up-to-date.

What sort of things should we be checking?

Thanks in advance.
Re: Change in explain plan due to Oracle upgrade [message #486160 is a reply to message #486150] Tue, 14 December 2010 01:28 Go to previous messageGo to next message
Michel Cadot
Messages: 68650
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Read the performances sticky, especially the last post, and provide the required information.

Regards
Michel
Re: Change in explain plan due to Oracle upgrade [message #486169 is a reply to message #486160] Tue, 14 December 2010 02:03 Go to previous messageGo to next message
cookiemonster
Messages: 13922
Registered: September 2008
Location: Rainy Manchester
Senior Member
How many rows does EMP_HISTORY actually have?
Sounds like a stats problem with that table or a change to how certain estimates are calculated between versions. However to say more we need context. So follow Michel's instructions.
Re: Change in explain plan due to Oracle upgrade [message #486237 is a reply to message #486150] Tue, 14 December 2010 06:59 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
The optimizer's behaviour does change between patchsets, usually for the better but it does sometimes get it wrong - even if the statistics are correct.
What licence do you have? If you have Enterprise Edition, plus the Tuning and Diagnostics packs, then you can use the SQL Tuning Advisor to look at the statement. This will check the statistics and perhaps build a profile that will improve the execution plan. The Enterprise Manager interface is quite easy to use.
Re: Change in explain plan due to Oracle upgrade [message #486573 is a reply to message #486237] Thu, 16 December 2010 19:03 Go to previous messageGo to next message
chowdhhx
Messages: 2
Registered: December 2010
Location: Sydney, Australia
Junior Member
Hi Michel. I've been in touch with my DBA's who unfortunately aren't able to provide a SQL_TRACE. In fact, the push-back I received was quite surprising.

In any case, I apologise for posting up without first making sure I have all the required information.

@cookiemonster: The table has about 600,000 records.
@John Watson: Thanks. I'll look into using SQL Tuning Advisor.
Re: Change in explain plan due to Oracle upgrade [message #486574 is a reply to message #486573] Thu, 16 December 2010 19:14 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Hi Michel. I've been in touch with my DBA's who unfortunately aren't able to provide a SQL_TRACE.

ALTER SESSION SET SQL_TRACE=TRUE;

SQL> SET AUTOTRACE TRACEONLY EXPLAIN STATISTICS

Both of which can be done by YOU!
Previous Topic: Tune the query
Next Topic: delete procedure taking time
Goto Forum:
  


Current Time: Mon May 13 18:19:21 CDT 2024