You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,3 @@
1
-
2
1
In our API, each SQL table is reflected as a set of GraphQL types. At a high level, tables become types and columns/foreign keys become fields on those types.
3
2
4
3
@@ -269,7 +268,7 @@ Connections wrap a result set with some additional metadata.
269
268
270
269
#### Aggregates
271
270
272
-
Aggregate functions are available on the collection's `aggregate` field. These allow you to perform calculations on the collection of records that match your filter criteria.
271
+
Aggregate functions are available on the collection's `aggregate` field when enabled via [comment directive](configuration.md#aggregate). These allow you to perform calculations on the collection of records that match your filter criteria.
273
272
274
273
The supported aggregate operations are:
275
274
@@ -434,6 +433,10 @@ The supported aggregate operations are:
434
433
- The return type for `avg` is always `BigFloat`.
435
434
- The return types for `min` and `max` match the original field types.
436
435
436
+
!!! note
437
+
438
+
The `aggregate` field is disabled by default because it can be expensive on large tables. To enable it use a [comment directive](configuration.md#Aggregate)
Copy file name to clipboardExpand all lines: docs/configuration.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,6 +95,41 @@ create table "BlogPost"(
95
95
comment on table "BlogPost" is e'@graphql({"totalCount": {"enabled": true}})';
96
96
```
97
97
98
+
### Aggregate
99
+
100
+
The `aggregate` field is an opt-in field that extends a table's Connection type. It provides various aggregate functions like count, sum, avg, min, and max that operate on the collection of records that match the query's filters.
101
+
102
+
```graphql
103
+
typeBlogPostConnection {
104
+
edges: [BlogPostEdge!]!
105
+
pageInfo: PageInfo!
106
+
107
+
"""Aggregate functions calculated on the collection of `BlogPost`"""
0 commit comments