Skip to content

Slow query from localdatastore #28

@FreudGit

Description

@FreudGit

Using iPhone 5(on sim it was instant), query fromlocaldatastore take a bit more than 2 seconds to get approx 600 results. (very more that sqlite request)

The funny thing are that querying and get results from online a near faster!! :)

To reproduce:

  • Get online data and pin it (queryDataFromParse)
    Close the app(or not)
  • get all data from LocalDatastore (queryShareFromParse_UsingLocalDataStore)

-(void) queryShareFromParse_UsingLocalDataStore {
NSLog(@"--[%s:%d]",PRETTY_FUNCTION,LINE);
PFQuery *query = [PFQuery queryWithClassName:@"A_Sharing"];
query.limit = 1000;
[query fromLocalDatastore];
NSError *error;
NSArray *aContents=[query findObjects:&error];
if (!error) {
NSLog(@"--[%s:%@]",PRETTY_FUNCTION,@"->Results received");
}
}

-(void) queryDataFromParse {
NSLog(@"--[%s:%d]",PRETTY_FUNCTION,LINE);
PFQuery *query = [PFQuery queryWithClassName:@"A_Sharing"];
[query orderByDescending:@"updatedAt"];
query.limit = 10000;
[query findObjectsInBackgroundWithBlock:^(NSArray *aContents, NSError *error) {
//if (error) return;
if (aContents.count>0) {
[PFObject pinAll:aContents];
PFObject *pfObject=aContents[0];
}
}];
}

I can provide sample and ApplicationId to your private email.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions