Here is an updated version of contrib/pg_stat_statements module.
I wrote:
> A shutdown hook is probably not needed because I can use proc_exit()
> or shmem_exit() for the purpose.
I added shutdown hook eventually because MyProc has been reset already
in on_shmem_exit(). A callback that resets MyProc is registered to
on_shmem_exit after shared_preload_libraries are loaded and callbacks
are called in order of LIFO.
Attached files are:
* startup+shutdown_hooks-1027.patch
The patch modifies corecode in the 3 points:
- startup_hook:
Called on server startup by startup process
where LoadFreeSpaceMap() in 8.3 had been called.
- shutdown_hook:
Called on server shutdown by bgwriter
where DumpFreeSpaceMap() in 8.3 had been called.
- shared_preload_libraries are loaded by auxiliary processes:
Windows port requires it.
* pg_stat_statements-1027.tgz
The pg_stat_statements contrib module. It requires patches
startup+shutdown_hooks-1027.patch (above) and auto_explain.patch
( http://archives.postgresql.org/message-id/20081009165157.9BE4.52131E4D@oss.ntt.co.jp ) .
Now it dumps statistics into file at server shutdown and load it
at the next restart. The default path of the saved file is
'global/pg_stat_statements.dump'.
* pgstatstatements.sgml
Documentation of the module.
Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center