PostGraphile has support in its plugin system for powerful aggregates. This system was only introduced in 4.4 and is not well documented yet; should you need aggregates good starting points are:
PgConnectionTotalCountPluginwhich adds a
totalCountaggregate to connections, counting all rows that match the criteria (ignoring pagination info)
- The @graphile/pg-aggregates
module which adds
sumaggregates to the schema (more to come)
- The Discord chat (feel free to @benjie in #help-and-support)
Aggregates are performed over the entire collection - not just the data that
would be returned if you were to query the nodes. This means they ignore the
offset arguments. This is deliberate
(if you only need aggregates over the data that matches your pagination
information then you could calculate these on the client).
If you're using
simpleCollections: "only" you can override it on a
per-collection basis with the
@simpleCollections smart comment.