-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Memory-constant streaming of Persistent entities from PostgreSQL -- -- This library provides a set of APIs for performing queries on -- Persistent entities in constant memory, streaming the results using -- conduit. -- -- The library relies on PostgreSQL-specific features to avoid loading -- all the results of a query into memory at once. This allows for -- accessing tables of millions of entities from Haskell without a memory -- blow-up. @package persistent-postgresql-streaming @version 0.1.0.0 module Database.Persist.Postgresql.Streaming.Internal -- | Run a Text query, with interpolated PersistValues, -- against a PostgreSQL backend using cursors, parsing the results with a -- custom parser function and streaming them back. -- -- If the parser function returns Left for any row, a -- PersistException will be thrown. rawSelectStream :: MonadResource m => ([PersistValue] -> Either Text result) -> Text -> [PersistValue] -> ConduitT () result (ReaderT (RawPostgresql SqlBackend) m) () module Database.Persist.Postgresql.Streaming -- | 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. selectStream :: (MonadResource m, MonadReader backend m, PersistRecordBackend record SqlBackend, BackendCompatible (RawPostgresql SqlBackend) backend) => [Filter record] -> [SelectOpt record] -> ConduitT () (Entity record) m ()