Fetching with a certain number and some offset with Realm(https://realm.io/) -


i trying turn realm(https://realm.io/) , come across problem. if handling data base storing large number of records, , want fetching number of records offset, how can realm. know, can done sql or core data. , don't want fetch data base , caculate ourselves in memory, needs time

since realm reads data disk upon access (even down property level), don't have worry reading more disk necessary. if want access next 10 objects after 100th, have skip accessing first 100.

for example:

let realm = realm() let modelobjects = realm.objects(mymodel) // => there 1000 items in 100..<110 {   let itematindex = modelobjects[i] // => inferred of type `mymodel`   itematindex.someproperty // => @ point data *just property* read disk   // perform operations in memory here... } // @ point, 10 objects ever read disk // , properties on objects accessed. 

i'm using realm swift in example, same concepts apply realm objective-c.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -