{"id":193,"date":"2024-03-21T15:08:44","date_gmt":"2024-03-21T13:08:44","guid":{"rendered":"http:\/\/130.61.57.200\/?p=193"},"modified":"2024-03-21T15:08:44","modified_gmt":"2024-03-21T13:08:44","slug":"find-statements-with-multiple-sql-plans","status":"publish","type":"post","link":"http:\/\/130.61.57.200\/index.php\/2024\/03\/21\/find-statements-with-multiple-sql-plans\/","title":{"rendered":"Find statements with multiple SQL Plans"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">SELECT<br>sql_id, COUNT(DISTINCT plan_hash_value)<br>FROM<br>dba_hist_sqlstat stat,<br>dba_hist_snapshot ss<br>WHERE<br>stat.snap_id = ss.snap_id<br>AND ss.dbid = stat.dbid<br>AND ss.instance_number = stat.instance_number<br>AND ss.begin_interval_time &gt;= sysdate &#8211; 7<br>AND ss.end_interval_time &lt;= sysdate AND stat.plan_hash_value &lt;&gt; 0<br>AND stat.executions_delta &gt; 0<br>AND stat.parsing_schema_name NOT IN ( &#8216;SYS&#8217;, &#8216;SYSTEM&#8217; )<br>GROUP BY<br>sql_id<br>having COUNT(DISTINCT plan_hash_value) &gt;1<br>ORDER BY<br>1;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SELECTsql_id, COUNT(DISTINCT plan_hash_value)FROMdba_hist_sqlstat stat,dba_hist_snapshot ssWHEREstat.snap_id = ss.snap_idAND ss.dbid = stat.dbidAND ss.instance_number = stat.instance_numberAND ss.begin_interval_time &gt;= sysdate &#8211; 7AND ss.end_interval_time &lt;= sysdate AND stat.plan_hash_value &lt;&gt; 0AND stat.executions_delta &gt; 0AND stat.parsing_schema_name NOT IN ( &#8216;SYS&#8217;, &#8216;SYSTEM&#8217; )GROUP BYsql_idhaving COUNT(DISTINCT plan_hash_value) &gt;1ORDER BY1;<\/p>\n","protected":false},"author":1,"featured_media":106,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-193","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle"],"blocksy_meta":[],"_links":{"self":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts\/193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/comments?post=193"}],"version-history":[{"count":1,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts\/193\/revisions"}],"predecessor-version":[{"id":194,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts\/193\/revisions\/194"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/media\/106"}],"wp:attachment":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/media?parent=193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/categories?post=193"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/tags?post=193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}