매우 중요한 레코드 집합을 반환하면서 핵심 데이터 데이터베이스를 검색하려고합니다.복잡한 핵심 데이터 검색
firstName (NSString)
lastName (NSString)
dateOfBirth (NSDate)
updatedAt (NSDate)
weight (NSNumber)
height (NSNumber)
나는 독특한 firstName
, lastName
및 dateOfBirth
값을 사용자의 목록을 얻을 수 있지만, 최신 이러한 각 사용자의 전체 기록을 반환 할 :
내 모델은 다음과 같이 보입니다 updatedAt
값.
그래서, 데이터베이스 등에 :
firstName: Jim, lastName: Brown, dateOfBirth: 1/1/2012, updatedAt: 1/1/2012, weight: 100, height: 100
firstName: Jim, lastName: Brown, dateOfBirth: 1/1/2012, updatedAt: 2/1/2012, weight: 120, height: 100
firstName: Joe, lastName: Smith, dateOfBirth: 1/1/2012, updatedAt: 1/1/2012, weight: 100, height: 100
firstName: Joe, lastName: Smith, dateOfBirth: 2/1/2012, updatedAt: 1/1/2012, weight: 100, height: 100
나는 배열을 얻을 것입니다 : 내가 다른 필터링 작업의 전체 무리를 수행 주위를 실행할 수 있습니다 알고
firstName: Jim, lastName: Brown, dateOfBirth: 1/1/2012, updatedAt: 2/1/2012, weight: 120, height: 100
firstName: Joe, lastName: Smith, dateOfBirth: 1/1/2012, updatedAt: 1/1/2012, weight: 100, height: 100
firstName: Joe, lastName: Smith, dateOfBirth: 2/1/2012, updatedAt: 1/1/2012, weight: 100, height: 100
을,하지만 난 궁금했다 이것을 도울 수있는 "바로 가기"가있었습니다. 내가 updatedAt
값을 얻는 데 관심이 없다면 [fetchRequest setReturnsDistinctResults:YES]
을 사용할 수 있지만 반입 할 속성에 updatedAt
을 포함하면이 모든 레코드가 본질적으로 반환됩니다. 나는 매우 커서 (10,000 레코드 이상) 될 수 있기 때문에 전체 데이터베이스를 NSArray
에로드하는 것에 대해 걱정이됩니다.