esqueleto-streaming-0.1.0.0: Memory-constant streaming of Esqueleto results from PostgreSQL
Safe HaskellNone
LanguageHaskell2010

Database.Esqueleto.PostgreSQL.Streaming

Synopsis

Documentation

selectCursor :: (SqlSelect a r, MonadIO m, MonadResource m, BackendCompatible (RawPostgresql SqlBackend) backend) => SqlQuery a -> ConduitT () r (ReaderT backend m) () Source #

Execute an esqueleto SELECT query against a PostgreSQL backend and return a stream of the results in constant memory, using the PostgreSQL cursor feature.

NB: this function is likely to perform worse than select on small result sets.

NB: for large result sets, this function is likely to perform very poorly unless you manually configure the cursor_tuple_fraction setting to be close to 1. This setting decides how much PostgreSQL will prioritise returning the first rows quickly vs. returning all rows efficiently. See

https://postgresqlco.nf/doc/en/param/cursor_tuple_fraction/

for more.