title: iPhone SDK: loading UITableView from SQLite
body: <p>I think I got a good handle on UITableViews and on getting/inserting data from/to SQLite db. I am straggling with an architectural question.</p>
  
  <p>My application saves 3 values int the database, there can be many/many rows. However would I load them in the table?</p>
  
  <p>From all the tutorials I have seen, at one point entire database is loaded in the NSMutableArray or similar object via performing SELECT statement. </p>
  
  <p>Then when </p>
  
  <p>-(UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath</p>
  
  <p>called, rows required are dolled out from the previous loaded NSMutableArray (or similar stracture).</p>
  
  <p>But what i have have thousands for rows? Why would I pre-load them?</p>
  
  <p>Should I just query database each time cellForRowAtIndexPath is called? If so, what would I use as an index?</p>
  
  <p>Each row in the table will have an AUTOINCREMENT index, but since some rows may be deleted index will not correspond to rows in the table (in the SQL I may have something like this with row with index 3 missing):</p>
  
  <p>1 Data1 Data1
  2 Data2 Data2
  4. data3 data3</p>
  
  <p>Thanks</p>