NSArray vs. SQLite for Complex Queries on iPhone
Posted
by GingerBreadMane
on Stack Overflow
See other posts from Stack Overflow
or by GingerBreadMane
Published on 2010-05-02T06:19:10Z
Indexed on
2010/05/02
6:27 UTC
Read the original article
Hit count: 236
Developing for iPhone, I have a collection of points that I need to make complex queries on. For example: "How many points have a y-coordinate of 10" and "Return all points with an X-coordinate between 3 and 5 and a y-coordinate of 7".
Currently, I am just cycling through each element of an NSArray and checking to see if each element matches my query. It's a pain to write the queries though. SQLite would be much nicer. I'm not sure which would be more efficient though since a SQLite database resides on disk and not in memory (to my understanding). Would SQLite be as efficient or more efficient here? Or is there a better way to do it other than these methods that I haven't thought of? I would need to perform the multiple queries with multiple sets of points thousands of times, so the best performance is important.
© Stack Overflow or respective owner