postgresql_16:7.1.147.4 Notes
PostgreSQL 16 > Reference > SQL Commands > FETCH > Notes
The cursor should be declared with the SCROLL option if one intends to use any variants of FETCH other than FETCH NEXT or FETCH FORWARD with a positive count. For simple queries PostgreSQL will allow backwards fetch from cursors not declared with SCROLL, but this behavior is best not relied on. If the cursor is declared with NO SCROLL, no backward fetches are allowed.
ABSOLUTE fetches are not any faster than navigating to the desired row with a relative move: the underlying implementation must traverse all the intermediate rows anyway. Negative absolute fetches are even worse: the query must be read to the end to find the last row, and then traversed backward from there. However, rewinding to the start of the query (as with FETCH ABSOLUTE 0) is fast.
DECLARE (see postgresql_16:7.1.97) is used to define a cursor. Use MOVE (see postgresql_16:7.1.155) to change cursor position without retrieving data.