1

I am trying to replicate the SQL query

SELECT * FROM table ORDER BY column_name LIMIT 100, 10;

The same query doesn't work in Athena, and when I looked up the Athena Documentation, it seems like LIMIT only accepts one value i.e. the count. So, only queries like LIMIT 100 would work.

So, how do we implement pagination for tables in Athena?

Piotr Findeisen
  • 19,480
  • 2
  • 52
  • 82
Parthapratim Neog
  • 4,352
  • 6
  • 43
  • 79
  • There are better ways than offset for pagination anyways. See https://use-the-index-luke.com/sql/partial-results – Shawn Jul 24 '19 at 07:14
  • 2
    Possible duplicate of [AWS Athena OFFSET support](https://stackoverflow.com/questions/51298622/aws-athena-offset-support) – Piotr Findeisen Jul 24 '19 at 09:05

1 Answers1

1
SELECT * FROM table ORDER BY column_name offset 0 rows LIMIT 100;
SELECT * FROM table ORDER BY column_name offset 100 rows LIMIT 100;

Using this you can do pagination for 100 rows

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103