title: INNER JOIN performance with '<' or '>' condition
body: <p>I have two tables with the column <code>SessionOrder</code>. This column is an integer datatype and have the following index: <code>CREATE INDEX OSIDX_&lt;internal name&gt; ON &lt;Entity&gt;</code>.</p>
  
  <p>I'm executing the following query:</p>
  
  <pre><code>SELECT i_0.rn, i_1.rn 
  FROM (
      SELECT "RawEvent"."SessionOrder" as rn
      FROM "RawEvent" i_0
      WHERE something = 12
  )
  INNER JOIN (
      SELECT "RawEvent"."SessionOrder" as rn
      FROM "RawEvent" i_1
      WHERE something = 14
  ) ON i_0.rn &gt; i_1.rn
  </code></pre>
  
  <p>The problem of this query is the <code>ON i_0.rn &gt; i_1.rn</code> that gets too slow and times out. 
  I replaced it by <code>ON i_0.rn = i_1.rn</code> and it was very fast but obviously does not produce the expected results.</p>
  
  <p>Does someone know a way to increase the performance of this query avoiding the timeout?
  Other goal of this question is to understand why it gets bad performance with <code>ON i_0.rn &gt; i_1.rn</code>.</p>
  
  <p>PS: It is not possible to increase the timeout time</p>