sqlite3_step() is quitting the iPhone application while executing inner joins - memory issue
I've a db file with multiple tables and each table has a minimum of 20k records. Now I'm trying to execute an inner join query in iPhone using sqlite3.
SELECT DISTINCT abc.id, abc.full_name FROM abc INNER JOIN xyz ON abc.id = xyz.id limit 10 ;
sqlite3_stmt *selectstmt;
if(sqlite3_prepare_v2(database, sql, -1, &selectstmt, NULL) == SQLITE_OK) {
while(sqlite3_step(selects开发者_运维技巧tmt) == SQLITE_ROW) {
// populating my custom objects
}
}
When I try the same query with tables having less number of rows, the sqlite3_step() command is working fine.
It would be great if someone can put some light on what exactly it is happening while the statement is getting executed. Will the entire tables be loaded into memory before executing the query and if so what could be the max. limit on the number of records in a table while executing an inner join.
When I'm trying to fetch records from a single table with 50k records its working fine without any issues.
Thanks in advance
Sudheer
精彩评论