diff --git a/doc/all-the-options.md b/doc/all-the-options.md index aa3d25d..a1cf4c9 100644 --- a/doc/all-the-options.md +++ b/doc/all-the-options.md @@ -55,7 +55,7 @@ Any function that creates a `Statement` or a `PreparedStatement` will accept the * `:concurrency` -- a keyword that specifies the concurrency level: `:read-only`, `:updatable`, * `:cursors` -- a keyword that specifies whether cursors should be closed or held over a commit: `:close`, `:hold`, -* `:fetch-size` -- an integer that guides the JDBC driver in terms of how many rows to fetch at once; it is common to set `:fetch-size` to zero or a negative value in order to trigger streaming of result sets -- some JDBC drivers require additional options to be set on the connection _as well_, +* `:fetch-size` -- an integer that guides the JDBC driver in terms of how many rows to fetch at once; sometimes you need to set `:fetch-size` to zero or a negative value in order to trigger streaming of result sets -- some JDBC drivers require additional options to be set on the connection _as well_, * `:max-rows` -- an integer that tells the JDBC driver to limit result sets to this many rows, * `:result-type` -- a keyword that affects how the `ResultSet` can be traversed: `:forward-only`, `:scroll-insensitive`, `:scroll-sensitive`, * `:timeout` -- an integer that specifies the (query) timeout allowed for SQL operations. diff --git a/doc/friendly-sql-functions.md b/doc/friendly-sql-functions.md index a9da2f6..25ce990 100644 --- a/doc/friendly-sql-functions.md +++ b/doc/friendly-sql-functions.md @@ -289,4 +289,11 @@ If you have a query where you want to select where a column is `IN` a sequence o What does this mean for your use of `next.jdbc`? In `plan`, `execute!`, and `execute-one!`, you can use `col = ANY(?)` in the SQL string and a single primitive array parameter, such as `(int-array [1 2 3 4])`. That means that in `next.jdbc.sql`'s functions that take a where clause (`find-by-keys`, `update!`, and `delete!`) you can specify `["col = ANY(?)" (int-array data)]` for what would be a `col IN (?,?,?,,,?)` where clause for other databases and require multiple values. +#### Streaming Result Sets + +You can get PostgreSQL to stream very large result sets (when you are reducing over `plan`) by setting the following options: + +* `:auto-commit false` -- when opening the connection +* `:fetch-size 4000, :concurrency :read-only, :cursors :close, :result-type :forward-only` -- when running `plan` (or when creating a `PreparedStatement`). + [<: Getting Started](/doc/getting-started.md) | [Result Set Builders :>](/doc/result-set-builders.md)