To get this amount of data you need to use unoptimized queries. Put it on the order field and all inner queries will be executed unoptimized.
order(
first: 100
filter: {changedDate:{_gte: 20210101}},
unoptimized :true
)
This allows you to ask for totalCount and pageInfo fields, which otherwise do not work with optimized joins.
query($cid :Int!) {
useCompany(no: $cid)
{
order(
first: 100
filter: {changedDate:{_gte: 20210101}},
unoptimized :true
)
{
totalCount
items {
orderNo
orderDate
changedDateTime
createdDateTime
joindown_CustomerTransaction_via_Order
{
totalCount
pageInfo {
hasNextPage
startCursor
endCursor
}
items {
orderNo
invoiceNo
customerNo
voucherNo
valueDateAsDate
amountDomestic
debitAmountDomestic
creditAmountDomestic
changedDateTime
createdDateTime
}
}
joindown_ProductTransaction_via_Order{
totalCount
pageInfo {
hasNextPage
startCursor
endCursor
}
items {
orderNo
transactionNo
invoiceNo
productNo
quantity
}
}
joindown_OrderLine_via_Order
{
totalCount
pageInfo {
hasNextPage
startCursor
endCursor
}
items {
orderNo
lineNo
productNo
}
}
}
}
}
}
We have the 1000 rows limit, but it's for each back-end query. If you run unoptimized, then this query will do:
request for the 100 orders (within the 1000 limit)
for each order:
one request for customer transactions
one request for product transactions
one request for order lines
So this should allow you to get up to 1000 customer transactions, 1000 product transactions, and 1000 order lines for each order.
When you use pageInfo, you can know whether you got all the data from a joined table, such as the order lines. Here I am limiting to 3:
joindown_OrderLine_via_Order(first: 3)
{
totalCount
pageInfo {
hasNextPage
startCursor
endCursor
}
items {
orderNo
lineNo
productNo
}
}
And I get back something like this:
"joindown_OrderLine_via_Order": {
"totalCount": 6,
"pageInfo": {
"hasNextPage": true,
"startCursor": "MA==",
"endCursor": "Mw=="
},
"items": [
{
"orderNo": 1,
"lineNo": 1,
"productNo": "312"
},
{
"orderNo": 1,
"lineNo": 2,
"productNo": "313"
},
{
"orderNo": 1,
"lineNo": 3,
"productNo": ""
}
]
}
You can use the endCursor to query the orderLines table directly, for the rest of the lines. But you need to use the right filter too (what order it belongs to):
orderLine(filter: {orderNo :{_eq :1}}, after : "Mw==")
{
totalCount
pageInfo {
hasNextPage
startCursor
endCursor
}
items {
orderNo
lineNo
productNo
}
}
And then you get the rest:
"orderLine": {
"totalCount": 6,
"pageInfo": {
"hasNextPage": false,
"startCursor": "Mw==",
"endCursor": "Ng=="
},
"items": [
{
"orderNo": 1,
"lineNo": 4,
"productNo": ""
},
{
"orderNo": 1,
"lineNo": 5,
"productNo": ""
},
{
"orderNo": 1,
"lineNo": 6,
"productNo": "311"
}
]
},
... View more