Caching data

By default, LS:DO caches the data you retrieve with a query; that is, it stores the data in memory. This is useful when you are moving back and forth between rows and don't want to have to fetch them again, but it uses up memory fairly quickly.

Limiting the cache size conserves memory, but restricts the number of rows stored at one time. New rows are fetched only for methods that move to a higher-numbered row; those newly fetched rows displace older rows in the cache. Attempting to revisit a lower-numbered row that has already been flushed raises the "Cannot access requested row" error; you have to re-execute the query first.

If you plan to process a table in sequence and will not revisit processed rows, you should limit the cache. If you intend to revisit previously processed rows, cache only enough rows so you don't have to re-fetch those rows. When you limit the cache size, limit the fetch batch size accordingly so you don't fetch more rows than you can store in the cache.

Note: Using the MaxRows property to limit the number of rows fetched into the result set from a large table is useful for testing.