fetchsize setting sets the number of rows to be retrieved by the JDBC
driver at once. This setting is useful for handling large data sets.
This is a session level setting.
By default, the fetch size is 0, which uses the JDBC driver’s default settings.
It should be noted that this setting may be ignored by the JDBC driver, or having to be used in conjunction with other settings to be effective.
This setting is only active for the current connection. The setting is lost when the connection is closed.
usage: .set fetchsize [size]
Without the size argument, it displays the current session’s fetch size.
-- Exporting large amount of data in PostgreSQL .autocommit off .set fetchsize 10 .export csv largedataset.csv SELECT * FROM MyBigTable; -- restore settings .autocommit on .set fetchsize 0