title: Oracle scaling while executing dynamically generated SQL queries
body: <p>I have a use case where in the user some input data and then in backend  SQL queries are generated  depending on inputs.</p>
  
  <p>User enters multiple filter criteria which gets translated into a new 
  clause.Eg <code>(someCol1='valA' and someColB ='valP' )</code></p>
  
  <p>User can enter as many as 10000 clauses and the DB takes a hit.</p>
  
  <p>Eg</p>
  
  <pre><code>select * from table where  (
  (someCol1='valA' and someColB ='valP' ) OR
  (someCol1='valB' and someColB ='valQ' ) OR
  (someCol1='valC' and someColB ='valR' ) OR
  (someCol1='valD' and someColB ='valS' ) OR
  ....
  (someCol1='valE' and someColB ='valT' ) OR
  )
  </code></pre>
  
  <p>The problem is the execution time increases when the number of clauses are  large (around 1000).Response time can as large as 5 min but it the job  should never fail.</p>
  
  <p>I am using an Oracle DB, and there are no DB joins. All queries run against single DB.</p>