【发布时间】:2019-12-10 07:11:16
【问题描述】:
我有一个发票模型,例如:
type Invoice {
id
amount
}
我有 350,000 张发票。我如何汇总所有发票的金额。 (最大限制为 1000)
这个 hack 行不通:https://www.prisma.io/forum/t/query-all-size-limit/557,因为我的行太多。
相关问题:https://github.com/prisma/prisma/issues/2162https://github.com/prisma/prisma/issues/259https://www.prisma.io/forum/t/query-all-size-limit/557https://www.prisma.io/forum/t/sun-amount-more-than-350000-rows/7611
【问题讨论】:
-
这样的事情听起来最好在 GraphQL 服务器上计算和提供;
Invoice是否有pagination实现?如果您坚持查询,则可以改为进行多个查询,一次获取 1,000 个。 -
感谢@Jim“最好在 GraphQL 服务器上计算和服务” ==> 我在 GraphQL 服务器上执行此查询.. 在解析器中。我只会返回结果到前端