Fast implicit close

When you specify the FETCH FIRST n ROWS ONLY clause in a distributed query, Db2 might use a fast implicit close to improve performance. Fast implicit close is the process of Db2 closing a cursor after prefetching the n row or when no more rows are to be returned.

Fast implicit close can improve query performance, because it saves an additional network transmission between the client and the server.

Db2 uses fast implicit close when all of the following conditions are true:
  • The query uses limited block fetch.
  • The query does not retrieve any LOBs.
  • The cursor is not a scrollable cursor.
  • Either of the following conditions is true:
    • The cursor is defined with the WITH HOLD option, and the package or plan that contains the cursor is bound with the KEEPDYNAMIC(YES) option.
    • The cursor is not defined with the WITH HOLD option.