I'm developing an Ionic App. I use PouchDB with relational-pouch localy and Cloudant remote. I run into several performance issues. Currently there are only 200 docs in the db. The syncing works fine.
When I run this code after the initial sync has been completed, I get, in my eyes, strange results. allDocs finishes fast after 60ms. find after 180ms. I use find here from pouchdb not relational-pouch. This is intenet. I created an Index for the field data.type. Is this the expected behaviour? I expect the view to be much faster as basically everything should be preloaded/ faster with the index. Maybe I didn't do the Index correct. Please advice.
Test script
console.time("allDocs");
this.dataService.db.allDocs({
include_docs: true,
startkey: "supplier_2",
endkey: "supplier_2\uffff"
}).then(articles=>{
console.timeEnd("allDocs");
console.log(articles);
console.time("find");
this.dataService.db.find({
selector: {'data.type': 'supplier'},
}).then(suppliers=> {
console.timeEnd("find");
console.log(suppliers);
}).catch(err=> {
console.log(err);
});
});
Index
this.db.createIndex({
index: {
fields: ['data.type'],
name: 'dataTypeIndex',
ddoc: 'dataType'
}
})
Thanks for your support! :)