| 1 |
<!-- doc/src/sgml/wal-for-extensions.sgml --> |
| 2 |
|
| 3 |
<chapter id="wal-for-extensions"> |
| 4 |
<title>Write Ahead Logging for Extensions</title> |
| 5 |
|
| 6 |
<para> |
| 7 |
Certain extensions, principally extensions that implement custom access |
| 8 |
methods, may need to perform write-ahead logging in order to ensure |
| 9 |
crash-safety. <productname>PostgreSQL</productname> provides two ways |
| 10 |
for extensions to achieve this goal. |
| 11 |
</para> |
| 12 |
|
| 13 |
<para> |
| 14 |
First, extensions can choose to use <link linkend="generic-wal">generic |
| 15 |
WAL</link>, a special type of WAL record which describes changes to pages |
| 16 |
in a generic way. This method is simple to implement and does not require |
| 17 |
that an extension library be loaded in order to apply the records. However, |
| 18 |
generic WAL records will be ignored when performing logical decoding. |
| 19 |
</para> |
| 20 |
|
| 21 |
<para> |
| 22 |
Second, extensions can choose to use a <link linkend="custom-rmgr">custom |
| 23 |
resource manager</link>. This method is more flexible, supports logical |
| 24 |
decoding, and can sometimes generate much smaller write-ahead log records |
| 25 |
than would be possible with generic WAL. However, it is more complex for an |
| 26 |
extension to implement. |
| 27 |
</para> |
| 28 |
|
| 29 |
&generic-wal; |
| 30 |
&custom-rmgr; |
| 31 |
|
| 32 |
</chapter> |