DataStore Query Performance Very Slow
See original GitHub issueBefore opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
React Native
Amplify APIs
DataStore
Amplify Categories
api
Environment information
# Put output below this line
Describe the bug
We are porting our AppSync/GraphQL based app to DataStore and what we are finding is that queries on the cached database are very slow. We are also finding that pagination of the queries makes no difference to the performance of the queries.
There are many tables with the largest table having about 8,000 records and most other tables having less than 1000 records. There are only 5 tables/models that have data.
Whether we are connected to the network or working offline it makes no difference to the performance.
In issue #6994 it talks of a first time slowing in performance, but we see consistently slow performance.
I have recorded a video of the performance we are seeing - both online and offline - to give you an idea of the problem we are facing.
https://user-images.githubusercontent.com/6362888/120909860-f74b7180-c6bc-11eb-97dc-300f8d19ab4d.mp4
Expected behavior
The database is local so we should be seeing almost instant responses to our queries. The performance of our existing AppSync GraphQL cache gives us almost instant responses so we expect the same or better performance than the existing AppSync GraphQL database.
Reproduction steps
Not sure how to replicate this as the database I have has 48 models and 200 GSI’s and takes about 6 hours of incremental (manual) pushes to deploy into a new environment.
Code Snippet
// Put your code below this line.
Log output
// Put your logs below this line
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
iPhone 7
Mobile Operating System
14.5
Mobile Browser
Not relevant
Mobile Browser Version
No response
Additional information and screenshots
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:110 (46 by maintainers)
@sacrampton, @jeremy-white, @mjaydeep01 - this feature has been officially released as part of
aws-amplify@4.2.6
! The documentation change will follow shortly, but in the meantime, here’s how you can enable it in your app:(Note: this new storage adapter is only compatible with React Native CLI-generated apps. Expo support will be added in the future)
Install:
Enable in your app:
I’m closing this issue, as the new storage adapter addresses the performance concerns expressed in the issue. Please create a new issue if you require assistance with this feature.
Hi @iartemiev - one final update from my testing. On the desktop you ship a storage adapter for IndexedDB which is a NoSQL database. So we did a test on the desktop with the large 30K+ Asset data set described above using the full schema.
It took about 11 minutes for the full dataset to download - but after that a query of the Asset table took 2 seconds. This compares with 64 seconds on Mobile App (React Native).