persistent-postgresql-streaming-0.1.0.0: Memory-constant streaming of Persistent entities from PostgreSQL
Safe HaskellNone
LanguageHaskell2010

Database.Persist.Postgresql.Streaming

Synopsis

Documentation

selectStream :: (MonadResource m, MonadReader backend m, PersistRecordBackend record SqlBackend, BackendCompatible (RawPostgresql SqlBackend) backend) => [Filter record] -> [SelectOpt record] -> ConduitT () (Entity record) m () Source #

Run a query against a PostgreSQL backend, streaming back the results in constant memory using the PostgreSQL cursor feature.

NB: this function is likely to perform worse than selectSource 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.