SQL High Sharable Memory
<p>I have a problem in my Oracle BBDD. A query consumes a lot of SGA, until the BBDD start to give the error ORA-04031 and I have to reset it.</p>

<p>In the AWR i can see the Query, in the "SQL ordered by Sharable Memory". The query appears a lot of times in this section, one by each distinct "or's", example:</p>

<p>Query 1:</p>

<pre><code>...My Query... WHERE ( inc.ID =:"SYS_B_131"
  OR inc.ID                  =:"SYS_B_132"
  OR inc.ID                  =:"SYS_B_133"
  OR inc.ID                  =:"SYS_B_134" )
</code></pre>

<p>Query 2:</p>

<pre><code>...My Query... WHERE ( inc.ID =:"SYS_B_131"
  OR inc.ID                  =:"SYS_B_132"
  OR inc.ID                  =:"SYS_B_133"
  OR inc.ID                  =:"SYS_B_134"
  OR inc.ID                  =:"SYS_B_135"
  OR inc.ID                  =:"SYS_B_136"
  OR inc.ID                  =:"SYS_B_137"
  OR inc.ID                  =:"SYS_B_138" )
</code></pre>

<p>Etc, etc.</p>

<p>My question is, the Query with 4 "or" items have a memory consumption of 3MB, the query with 500 "or" items have of memory consumption of 1GB , ¿Is this normal?</p>