# Web DBI - Browsing pages of results

- ## Re-execute query each time then count/discard (simple but expensive)

  - works well for small cheap results sets or where users rarely view many pages
  - fast initial response, degrades gradually for later pages
  - count/discard in server is better but still inefficient for large result sets
  - count/discard affected by inserts and deletes from other processes

- ## Re-execute query with where clause using min/max keys from last results

  - works well where original query can be qualified in that way

- ## Select and cache full result rows somewhere for fast access

  - can be expensive for large result sets with big fields

- ## Select and cache only the row keys, fetch full rows as needed

  - optimisation of above, use ROWID if supported, "select … where key in (…)"

- ## If data is static and queries predictable

  - then custom pre-built indexes may be useful

- ## The caches can be stored...

  - on web server, e.g., using DBM file with locking (see also ‘spread’)
  - on database server, e.g., using a table keyed by session id

Previous slide | Next slide | Back to first slide | View graphic version