funcool / funcool/clojure.jdbc

Docs: clarify cursor behavior

未关闭
#44 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Clojure
星标
106
派生
23
PR 合并指标
30 天内没有已合并 PR

描述

Using clojure.jdbc w/ Hikari CP and Postgresql 11.

When attempting to create a cursor as described in the docs the process still ends up trying to load the whole result set into memory.

``` clojure
(def conn (jdbc/connection pool))
(def cursor (jdbc/fetch-lazy conn "SELECT \"uuid\", data_bytes FROM visitor_data;"))
(def cursor-seq (jdbc/cursor->lazyseq cursor)) ;; hangs here
```

If I explicitly set auto-commit and the fetch size I don't have that problem:
``` clojure
(def conn (jdbc/connection pool))
(def cursor (jdbc/fetch-lazy conn "SELECT \"uuid\", data_bytes FROM visitor_data;"))
(.setFetchSize (.-stmt cursor) 50)
(.setAutoCommit (.getConnection (.-stmt cursor)) false)
(def cursor-seq (jdbc/cursor->lazyseq cursor))
```

is this a documentation problem or is the library expected to modify those settings for us?

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。