Ios :- Core data and predicate on large volume.
In one of my current project requirement is to view product information in particular date range.
No. Of products :- P1 P2 P3 P4 P5
No of channels....:- C1 C2 C3 C4
No of regions :- R1 R2 R3 R4
Depending on any of the above combination user can select either "Daily" "Weekly" "Monthly" "Yearly" for daily for Perticular date there will be (5 produtcts *4 channel*4 regions)= 80 Combinations
Daily :- so for 5 years it will be (80*365*5=1,46, 000) records
Montly:- for 5 years :- 12 *5 = 60 so total 4800 records.
quarterly for 5 years :- 4 *5 = 20 so total (20*80) =1600 records.
That means we can calculate all daily, monthly, quarterly and yearly using daily data.
As user can vary the selected combination of products, channels and regions and can also select the date range.
Looking at the search criteria, we decided to load the data into core data and then use predicate to fetch the data.
Day :- On perticular date
Weekly :- On friday i.e. end of week
Monthly :- 31/30 month end date
Quarterly :- March end date , Jun end date etc.
Yearly 31st dec date
But my question is:
1.Can we use Daily model to fetch also monthly, quarterly and yearly information. Memory optimization good vs response time less 2. Separate data model for Daily , Monthly and quarterly. (Yearly we can calculate from quarterly). [Response time good but duplicate data]
Yes we can use date predicates .But our concern was is CoreData that efficient to query such large data considering we have number of combinations on product region and channel. We can use IN predicaate for(product region and channel) .If it was Oracle we would have definitely gone for only Daily data model.
Could anyone please suggest which is the best option to model this data?