Performance Problems when working with large datasets
See original GitHub issueGoals
Our app allows users to sort the photos on their device in a unique way. This means they can’t just use the built in photos app to do the sorting.
As a result we have Photos and Albums. We store a URI to the photo and what albums the photo has been sorted to.
Expected Results
Writing 50 records should take less than a second.
Actual Results
If there are more than 5,000 records in the database, adding 50 more takes ~1 second. Since this is react native this absolutely kills the responsiveness of the app.
NOTE: This is definitely a release build, Android.
Steps to Reproduce
I’ll create a repro if necessary, just want to make sure this isn’t expected behaviour before I do.
Code Sample
export class Photo {
static schema: ObjectSchema = {
name: 'Photo',
primaryKey: 'uri',
properties: {
timestamp: { type: 'date', indexed: true },
uri: 'string',
width: 'double',
height: 'double',
albums: 'Album[]',
inTrash: { type: 'bool', default: false, indexed: true },
lastSeenImportId: { type: 'string?', indexed: true },
},
};
// ...
}
export class Album {
static schema: ObjectSchema = {
name: 'Album',
primaryKey: 'id',
properties: {
id: 'string',
name: 'string',
photos: { type: 'linkingObjects', objectType: 'Photo', property: 'albums' },
},
};
// ...
}
Version of Realm and Tooling
- Realm JS SDK Version: 2.29.2
- React Native: 0.59.10
- Client OS & Version: Android, all tested versions.
- Which debugger for React Native: None, Release build with console.log profiling.
Issue Analytics
- State:
- Created 4 years ago
- Comments:21 (8 by maintainers)
Top Results From Across the Web
Performance on Large Datasets - healthcareai
If you have a dataset with more than 20k rows or 50 columns, you might run into performance issues. The size of your...
Read more >Code performance in R: Working with large datasets
Some computations will not only become very slow, but even impossible for large datasets, for example, due to working memory. But the good...
Read more >3 Common Database Performance Issues (and How to Fix ...
#1. A Lack of Indexes · #2. Inefficient Querying · #3. Improper Data Types1 · How to Spot Problems · It's an Easy...
Read more >8 Tips and Tricks for Working with Large Datasets in Machine ...
1.) It loads the entire data into the RAM memory at once and may cause memory issues while working with out-of-memory datasets. The...
Read more >What are real-world common problems with large datasets ...
Time — Large datasets require large amount of time to collect data, process data, annotate data, analyze data, build models. · Storage —...
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
@kneth so if I’ve understood correctly you’re saying that this is a feature:
addListener
create
That’s the expected behaviour?
I buy the logic for notifying quickly, and for why there might be a delay in updating existing live objects to reflect the new data, but asking for a new result set needs to return a correct result.
Otherwise how do we actually build a feature with listeners? The app’s UI will be updated quickly but it’ll be wrong. The screen won’t reflect the item the user just added to the DB, and then when it’s “really” there we don’t get any notification to re-render.
@thekevinbrown Thanks for splitting into multiple issues. I hope that I can return to them shortly.