huaxin zhang <uwcssa@gmail.com> writes:
> I want to purge all contents in the bufferpool,
Why do you think that's a good idea? It certainly won't purge the
kernel's disk caches, so if you're hoping to restore the system to
ground zero this won't do it.
> and I did this by
> calling "InitBufTable(256)" (buf_table.c) after each query.
Let's see ... I'd expect that to run out of shared memory pretty soon,
but not till after it's thoroughly corrupted your database ;-)
There is no API exported by bufmgr.c that does what you want. Something
like a combination of FlushRelationBuffers and DropRelFileNodeBuffers,
but processing a whole database (see also DropBuffers) or the whole buffer
cache, might work. You can't drop a buffer that some other process has
pinned, however.
regards, tom lane