| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Rel8.Internal.Query.Materialize
Documentation
materialize :: Table Expr a => Query a -> (Query a -> Query b) -> Query b Source #
materialize takes a Query and fully evaluates it and caches the
results thereof, and passes to a continuation a new Query that simply
looks up these cached results. It's usually best not to use this and to let
the Postgres optimizer decide for itself what's best, but if you know what
you're doing this can sometimes help to nudge it in a particular direction.
materialize is currently implemented in terms of Postgres'
@WITH syntax,
specifically the WITH _ AS MATERIALIZED (_) form introduced in PostgreSQL
12. This means that materialize can only be used with PostgreSQL 12 or
newer.