title: Sql Query Taking longer to execute than expected time
body: <p>I am trying to execute the query below but it's taking around 40mins.</p>
  
  <pre><code>select logentryid 
  from (
       select * from logentry_payloaddata pd,
       logentry le
       where (
              pd.entryid=le.logentryid
         and
              le.eventdatetime=(trunc(sysdate) - 14)
       )
       order by le.logentryid asc
  )
  </code></pre>
  
  <p>In table logentry there are 4,24,91,461 records and in logentry payload data there are 4,15,16,346 records (or "42,491,461" and "41,516,346" in some parts of the world, or even "42.491.461" and "41.516.346" in some other parts -- Ed.)</p>
  
  <p>There are indexes on logentryid and entryid in resp tables.</p>
  
  <p>Could someone please suggest what to do in this case.</p>