title: Time consuming query to Skip First inserted record of Id list
body: <p>In postgressql I have a data with multiple articleId list on table. Whereever I query it should skip first inserted record of particular userID in specified list of articleID.</p>
  <pre><code>select * from (
    select * , row_number() over (partition by articleId order by date) rn
    from table where articleId in (1200) and userId = 1
  ) t
  where t.rn &gt; 1
  </code></pre>
  <p>It will return expected record by skip first inserted record of each articleId of particular userId.
  But above query consuming more time to execute if there is large data.</p>
  <p>table:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">id</th>
  <th style="text-align: center;">name</th>
  <th style="text-align: right;">articleId</th>
  <th style="text-align: right;">date</th>
  <th style="text-align: right;">userId</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">1</td>
  <td style="text-align: center;">abc</td>
  <td style="text-align: right;">1200</td>
  <td style="text-align: right;">2021-05-01 06:09:35</td>
  <td style="text-align: right;">1</td>
  </tr>
  <tr>
  <td style="text-align: left;">2</td>
  <td style="text-align: center;">bcd</td>
  <td style="text-align: right;">1400</td>
  <td style="text-align: right;">2021-05-02 06:08:35</td>
  <td style="text-align: right;">1</td>
  </tr>
  <tr>
  <td style="text-align: left;">3</td>
  <td style="text-align: center;">xyz</td>
  <td style="text-align: right;">1200</td>
  <td style="text-align: right;">2021-05-03 09:09:35</td>
  <td style="text-align: right;">2</td>
  </tr>
  <tr>
  <td style="text-align: left;">4</td>
  <td style="text-align: center;">pqr</td>
  <td style="text-align: right;">1200</td>
  <td style="text-align: right;">2021-05-04 08:09:35</td>
  <td style="text-align: right;">1</td>
  </tr>
  <tr>
  <td style="text-align: left;">5</td>
  <td style="text-align: center;">xyz</td>
  <td style="text-align: right;">1200</td>
  <td style="text-align: right;">2021-05-05 09:09:35</td>
  <td style="text-align: right;">3</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Expected query Output:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">id</th>
  <th style="text-align: center;">name</th>
  <th style="text-align: right;">articleId</th>
  <th style="text-align: right;">date</th>
  <th style="text-align: right;">userId</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">4</td>
  <td style="text-align: center;">pqr</td>
  <td style="text-align: right;">1200</td>
  <td style="text-align: right;">2021-05-04 08:09:35</td>
  <td style="text-align: right;">1</td>
  </tr>
  </tbody>
  </table>
  </div>