Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
F.28. pg_prewarm
Prev UpAppendix F. Additional Supplied ModulesHome Next

F.28. pg_prewarm

Thepg_prewarm module provides a convenient way to load relation data into either the operating system buffer cache or thePostgreSQL buffer cache.

F.28.1. Functions

pg_prewarm(regclass, mode text default 'buffer', fork text default 'main',           first_block int8 default null,           last_block int8 default null) RETURNS int8

The first argument is the relation to be prewarmed. The second argument is the prewarming method to be used, as further discussed below; the third is the relation fork to be prewarmed, usuallymain. The fourth argument is the first block number to prewarm (NULL is accepted as a synonym for zero). The fifth argument is the last block number to prewarm (NULL means prewarm through the last block in the relation). The return value is the number of blocks prewarmed.

There are three available prewarming methods.prefetch issues asynchronous prefetch requests to the operating system, if this is supported, or throws an error otherwise.read reads the requested range of blocks; unlikeprefetch, this is synchronous and supported on all platforms and builds, but may be slower.buffer reads the requested range of blocks into the database buffer cache.

Note that with any of these methods, attempting to prewarm more blocks than can be cached — by the OS when usingprefetch orread, or byPostgreSQL when usingbuffer — will likely result in lower-numbered blocks being evicted as higher numbered blocks are read in. Prewarmed data also enjoys no special protection from cache evictions, so it is possible that other system activity may evict the newly prewarmed blocks shortly after they are read; conversely, prewarming may also evict other data from cache. For these reasons, prewarming is typically most useful at startup, when caches are largely empty.

F.28.2. Author

Robert Haas<rhaas@postgresql.org>


Prev Up Next
F.27. pg_freespacemap Home F.29. pgrowlocks
epubpdf
Go to PostgreSQL 10
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp