title: Skip every nth result row in PostgreSQL
body: <p>I'm looking for a way to skip rows in PostgreSQL.</p>
  
  <p>Two ways I could do this are using:</p>
  
  <pre><code>SELECT * FROM table WHERE id % 5 = 0
  </code></pre>
  
  <p>However I'd have to fetch sequential rows to properly skip. For instance if I fetch row (with ids) 0,3,5,
   it would not skip 4 out of 5 rows, but instead result in (ids) 0 and 5.</p>
  
  <p>Or skip outside of SQL:</p>
  
  <pre><code>$count = 0;
  while($row = progres_fetch_row($result))
    if ($count++ % 5 == 0)
       // do something 
  </code></pre>
  
  <p>What is the fastest way to get every nth row from a SQL database?</p>