Lilz
Lilz

Reputation: 4091

Get query results in ranges Redshift

I am running a query and it is too large. How may I retrieve the results in sections? For example, 1 million rows at a time.

Thank you

Upvotes: 1

Views: 207

Answers (1)

botchniaque
botchniaque

Reputation: 5094

Use CURSOR

DECLARE my_curosor CURSOR FOR 
SELECT ....

FETCH FORWARD 5 FROM my_cursor;
FETCH FORWARD 5 FROM my_cursor;
...
CLOSE my_cursor;

Another simplistic approach is to use LIMIT and OFFSET clauses.

Upvotes: 1

Related Questions