Computed views - Working in Dev env but always timeouting in Prod

Hey team, I have a view that aggregates some data. This view is working fine in Dev but timeouting in Prod, even on stores with very low dataset App: monster-store-credit.gadget.app Trace id: 9f91e89497dac826d74e15be8653d18d View name: dashboardReport
15 Replies
Yaman
YamanOP•2w ago
OK I spotted few cases where it doesn't timeout: - some of them have correct results - other have totally inconsistent results I'm not sure what's going on and how to debug here... I've ran an inline view version in API playground of the one which is inconsistent => works correctly the only difference is that in my inline view I had to explicitely give the shopId constraint in a where clause, whereas the view is called from a route that is called from the app using useFetch, so the view should have inherited automatically from my shop context right? (I have a correct gelly accessControl filter for the model I'm trying to fetch) So 2 issues here for me: - most of the time, my view is timeouting - when it's not timeouting, it sometimes gives me consistent results, sometimes not I can't even run a simple view like so:
await api.view(`{
shopifyShops {
aov: avg(cast(orders.totalPrice, type: "Number"))

[limit 10]
}
}`)
await api.view(`{
shopifyShops {
aov: avg(cast(orders.totalPrice, type: "Number"))

[limit 10]
}
}`)
It's timeouting 95% of the time 😬 Is there any known limitations about views performance?
Chocci_Milk
Chocci_Milk•2w ago
So, I'm not seeing any issues with this query, though, I can imagine that it could run for some time based on the amount of data in the order table. How are you testing this query?
Yaman
YamanOP•2w ago
In playground
Chocci_Milk
Chocci_Milk•2w ago
So I didn't try running your dashboardReport view but I ran the simple query and it worked I'm testing in production And the dashboardReport view just ran extremely quickly for me
Yaman
YamanOP•2w ago
You’re testing the query on my prod env? And no timeout for you?
Chocci_Milk
Chocci_Milk•2w ago
Yep
Yaman
YamanOP•2w ago
Wow … mhh weird. My dashboardReport is running live when my merchants goes to their app, and most of the call are timeouting
Chocci_Milk
Chocci_Milk•2w ago
So a few things though: - I didn't add an fields so I was returned nulls and 0s - I ran it from the api playground, not from the frontend The filters might be written in a way that would slow down the query a ton
Yaman
YamanOP•2w ago
Mhh can you try at least with currency parameters? USD Won’t match anything without currency params
Chocci_Milk
Chocci_Milk•2w ago
Yeah, let me test Ok, thats timing the query out
Yaman
YamanOP•2w ago
yeah
Chocci_Milk
Chocci_Milk•2w ago
I'm asking some information from the infra team to see what the best way to test queries might be
Yaman
YamanOP•2w ago
sometimes after few retries you can get a result (with inconsistent result when within an access control context but that's another issue) - so I know it's not the view itself the issue OK thanks Antoine, I have to AFK a while I'll catch up when I'm back Hey, any news ?
Chocci_Milk
Chocci_Milk•4d ago
The team is still looking into it Looks like there's been a little bit of progress. The team is still looking into why this is slow for you Going to mark this thread as closed. Please write a message to reopen it if you see any more issues
Gizmo
Gizmo•4d ago
Do you like this answer? ​

Did you find this page helpful?