|
11 | 11 | <para>
|
12 | 12 | The <filename>pg_buffercache</filename> module provides a means for
|
13 | 13 | examining what's happening in the shared buffer cache in real time.
|
| 14 | + It also offers a low-level way to evict data from it, for testing |
| 15 | + purposes. |
14 | 16 | </para>
|
15 | 17 |
|
16 | 18 | <indexterm>
|
|
21 | 23 | <primary>pg_buffercache_summary</primary>
|
22 | 24 | </indexterm>
|
23 | 25 |
|
| 26 | + <indexterm> |
| 27 | + <primary>pg_buffercache_evict</primary> |
| 28 | + </indexterm> |
| 29 | + |
24 | 30 | <para>
|
25 | 31 | This module provides the <function>pg_buffercache_pages()</function>
|
26 | 32 | function (wrapped in the <structname>pg_buffercache</structname> view),
|
27 |
| - the <function>pg_buffercache_summary()</function> function, and the |
28 |
| - <function>pg_buffercache_usage_counts()</function> function. |
| 33 | + the <function>pg_buffercache_summary()</function> function, the |
| 34 | + <function>pg_buffercache_usage_counts()</function> function and |
| 35 | + the <function>pg_buffercache_evict()</function> function. |
29 | 36 | </para>
|
30 | 37 |
|
31 | 38 | <para>
|
|
47 | 54 | </para>
|
48 | 55 |
|
49 | 56 | <para>
|
50 |
| - By default, use is restricted to superusers and roles with privileges of the |
51 |
| - <literal>pg_monitor</literal> role. Access may be granted to others |
52 |
| - using <command>GRANT</command>. |
| 57 | + By default, use of the above functions is restricted to superusers and roles |
| 58 | + with privileges of the <literal>pg_monitor</literal> role. Access may be |
| 59 | + granted to others using <command>GRANT</command>. |
| 60 | + </para> |
| 61 | + |
| 62 | + <para> |
| 63 | + The <function>pg_buffercache_evict()</function> function allows a block to |
| 64 | + be evicted from the buffer pool given a buffer identifier. Use of this |
| 65 | + function is restricted to superusers only. |
53 | 66 | </para>
|
54 | 67 |
|
55 | 68 | <sect2 id="pgbuffercache-pg-buffercache">
|
|
351 | 364 | </para>
|
352 | 365 | </sect2>
|
353 | 366 |
|
354 |
| - <sect2 id="pgbuffercache-sample-output"> |
| 367 | + <sect2 id="pgbuffercache-pg-buffercache-evict"> |
| 368 | + <title>The <structname>pg_buffercache_evict</structname> Function</title> |
| 369 | + <para> |
| 370 | + The <function>pg_buffercache_evict()</function> function takes a buffer |
| 371 | + identifier, as shown in the <structfield>bufferid</structfield> column of |
| 372 | + the <structname>pg_buffercache</structname> view. It returns true on success, |
| 373 | + and false if the buffer wasn't valid, if it couldn't be evicted because it |
| 374 | + was pinned, or if it became dirty again after an attempt to write it out. |
| 375 | + The result is immediately out of date upon return, as the buffer might |
| 376 | + become valid again at any time due to concurrent activity. The function is |
| 377 | + intended for developer testing only. |
| 378 | + </para> |
| 379 | + </sect2> |
| 380 | + |
| 381 | +<sect2 id="pgbuffercache-sample-output"> |
355 | 382 | <title>Sample Output</title>
|
356 | 383 |
|
357 | 384 | <screen>
|
|
0 commit comments