clarification on using aggregates with limit argument
See original GitHub issuesubscription{
suppliers_aggregate(limit:10){
nodes{
name
}
aggregate{
count
}
}
}
it still limit the aggregate query
SELECT
json_build_object(
'nodes',
coalesce(json_agg("nodes"), '[]'),
'aggregate',
json_build_object('count', COUNT(*))
) AS "root"
FROM
(
SELECT
1 AS "root__one",
row_to_json(
(
SELECT
"_1_e"
FROM
(
SELECT
"_0_root.base"."name" AS "name"
) AS "_1_e"
)
) AS "nodes"
FROM
(
SELECT
*
FROM
"public"."suppliers"
WHERE
('true')
) AS "_0_root.base"
LIMIT
10
) AS "_2_root"
heres the generated query. it doesnt define the only the node get to be limit
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
postgresql - How to apply ORDER BY and LIMIT in ...
I am applying order by p.name desc in two places ... Is there a way to avoid that? Yes. Aggregate with an ARRAY...
Read more >Understanding symmetric aggregates | Looker - Google Cloud
Symmetric aggregates prevent analysts — and anyone else who uses Looker — from accidentally miscalculating aggregates such as sums, averages, and counts.
Read more >Aggregate Functions in Tableau
An aggregate calculation that combines the values in the argument field. Null values are ignored. Note: The COLLECT function can only be used...
Read more >15: 38.12. User-Defined Aggregates - PostgreSQL
To define a new aggregate function, one selects a data type for the state value, an initial value for the state, and a...
Read more >Learn SQL: Aggregate Functions - SQLShack
While all aggregate functions could be used without the GROUP BY clause, the whole point is to use the GROUP BY clause. That...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@shahidhk I think the expected behaviour should be:
limit
So,
should fetch 10 rows of data, but
aggregate.count
returns Total number of rows of that table based on permission.@zesterquinn Since you’re adding the limit argument, this is the expected behaviour. If your intention is to get 10 items and also get the total count, you have to use two subscriptions: