A number, of the blocks of data to be prefetched into a buffer cache, is
determined dynamically at run time (e.g. during execution of a query),
based at least in part on the load placed on the buffer cache. An
application program (such as a database) is responsive to the number
(also called "prefetch size"), to determine the amount of prefetching. A
sequence of instructions (also called "prefetch size daemon") computes
the prefetch size based on, for example, the number of prefetched blocks
aged out before use. The prefetch size daemon dynamically revises the
prefetch size based on usage of the buffer cache, thereby to form a
feedback loop. Depending on the embodiment, at times of excessive use of
the buffer cache, prefetching may even be turned off. Although in one
embodiment described herein the prefetch size daemon is implemented in a
database, in other embodiments other kinds of applications and/or the
operating system itself can use a prefetch size daemon of the type
described herein to dynamically determine and change prefetch behavior.