Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7901055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:07:23+00:00 2026-06-03T09:07:23+00:00

I already asked a similar question but still can’t get it to work. I

  • 0

I already asked a similar question but still can’t get it to work. I have a core data database with 30k+ records. I am trying to fetch it into a tableview. I watched the WWDC presentation on core data and whatever the presenter suggested it didn’t work for me. I deleted most of the fields from that table and only left like 4 which contains nsstring and date. I used setFetchBatchSize with different numbers and still when using instruments the fetch controller was fetching all 30k records. I watched it over and still not sure what i am doing from to lower the fetch. I used a separate thread and showed svprogreshud but that made it even slower i guess because the thread is not running right away.

Also The data is divided 12 sections and i have a field in core database for it with one character to set up sections.

I also set -com.apple.CoreData.SQLDebug 1 and when running on the device it showed 3sec loading that fetch request with all the records but showed
CoreData: sql: pragma cache_size=200
CoreData: annotation: total fetch execution time: 3.1087s for 36684 rows.

Here is some of the code

-(void)useDocument{

    if (self.peopleDatabase.documentState == UIDocumentStateClosed){
        [self.peopleDatabase openWithCompletionHandler:^(BOOL success){
            [self setupFetchResultsController];

        }];

    } else if (self.peopleDatabase.documentState == UIDocumentStateNormal){
        [self setupFetchResultsController];
    }     
}

-(void)setupFetchResultsController
{

    NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"people"];
    request.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"pplicon" ascending:YES]];
    [NSFetchedResultsController deleteCacheWithName:nil];
    self.fetchedResultsController = nil;

    [request setFetchBatchSize:50];
    //[request setFetchLimit:100];

    self.fetchedResultsController = [[NSFetchedResultsController alloc]initWithFetchRequest:request managedObjectContext:self.peopleDatabase.managedObjectContext sectionNameKeyPath:@"pplicon" cacheName:@"peopleCache"]; 
}

Thank you in advance!

UPDATE
Jody thank you again for answering.
I went to the core data setup to the table and pplicon indexed is checked. Do i need to check anything else. I followed the directions for the wwdc video and ran instruments in core data fetches it shows NSManagedObjectContext executefetch .. Fetch Count 36684 and then another one with Fetch Count 12 Also in sampler the most time spent in peopleviewcontroller setupfetchResultsContoroller 363.75ms and UIAplication Run 287.6ms. In activity Monitor the app takes up 91mb real memory. Is there anyway to improve this time? What else can i check and see where the hang up is?

As far as the sections. I have a character in the database pplicon which used to show for section and the data is sort by it.

Data Model for now has one Entity with 5 Attribues as string and 1 Attribute as Date

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:07:24+00:00Added an answer on June 3, 2026 at 9:07 am

    I think I have commented on a very similar question in the past. You absolutely must run Instruments and see what it says. It will tell you exactly where it is spending its time.

    You are using sections, which can be expensive. Is your section attribute “pplicon” setup in the database as an Index? If not, you will most definitely have to scan all items in the database. The only chance you have of not scanning all records is to make it an index. The internals may be able to just use an index table to get the unique index values. However, it still has to return section objects.

    Again, you must turn on instruments while testing so you can see exactly where you are spending your time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I asked a similar question to this already, but I still can't see the
I already asked similar question here, but I still get some errors, so I
I have already asked a similar question earlier but I have notcied that I
I have asked a similar question before, but didn't get very good results. I've
I have asked a similar question to this one already but I think it
I already asked a similar question, PE Header requirements , but I'm not really
Apologies if this was already asked but, I have had a look and can't
I have another question. Quite similar to the other that i already asked (and
I already asked a similar question but this one is a bit different/specific: I'm
I have asked a similar question previously but it was never resolved so here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.