Different SQL ID for same SQL/HASH_VALUE [message #569837] |
Fri, 02 November 2012 07:55 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](//www.gravatar.com/avatar/084065d87a5155d8e324ebbadbf2db64?s=64&d=mm&r=g) |
suddhasatwa_bhaumik
Messages: 18 Registered: October 2011 Location: India
|
Junior Member |
|
|
Hello All,
I see one of my SQL's which is ran by the user on a 10.2.0.3 database changing its SQL_ID after some runs even if the query is not changed a bit! However the HASH VALUE for this query remains the same.
Can someone advice how a same query can have different SQL_ID's but same HASH_VALUE?
Note: Statistics are not modified on the base tables of this query.
Please let me know for further information.
Thanks,
Suddhasatwa
|
|
|
|
|
Re: Different SQL ID for same SQL/HASH_VALUE [message #569842 is a reply to message #569840] |
Fri, 02 November 2012 08:18 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
SQL is stored in the SGA. When oracle runs out of space in the SGA for new statements the least recently used statement in there is aged out (deleted) to make room.
Next time the statement is run it is reloaded into the SGA with a new sql_id.
|
|
|
|
|
|
|
|
Re: Different SQL ID for same SQL/HASH_VALUE [message #570056 is a reply to message #569871] |
Mon, 05 November 2012 04:02 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Roachcoach
Messages: 1576 Registered: May 2010 Location: UK
|
Senior Member |
|
|
LNossov wrote on Fri, 02 November 2012 16:46Theoretically it is possible. Because Oracle uses the last 4 bypes of MD5 hash value for the hash value of sql and the last 8 bytes for sqlid. So the hash values can be equal whereas the sqlid's different. But in this case the both sql texts have to be also different. Please verify this.
That was my understanding too, across multiple different instances so long as the text (including case) is identical, the sql_id is the same.
It's one of the things that makes punting baselines etc across our different environments so quick & easy.
|
|
|
|
Re: Different SQL ID for same SQL/HASH_VALUE [message #682028 is a reply to message #569837] |
Mon, 28 September 2020 01:45 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](//www.gravatar.com/avatar/f196170d7c7ccc86fdd1b6f7ef4b4df2?s=64&d=mm&r=g) |
amujawane
Messages: 1 Registered: September 2020
|
Junior Member |
|
|
I had the same observation with my concurrent program performance issue.
Resolution was, If there is any staging table being used in the query, recreate that table and respective indexes, this should resolve the issue.
Thanks,
Achal
|
|
|