pgfincore

PgFincore is a set of functions to manage pages in memory from PostgreSQL, handle low-level management of relations using mincore to explore cache memory. Project link:
http://pgfoundry.org/projects/pgfincore/

With PostgreSQL, each Table or Index is splitted in segments of (usually) 1GB, and each segment is splitted in pages in memory then in blocks for the filesystem.

Those functions let you know which and how many disk block from a relation are in the page cache of the operating system. It can provide the result as a VarBit and can be stored in a table. Then using this table, it is possible to restore the page cache state for each block of the relation, even in another server, thanks to Streaming Replication.

Other functions are used to set a *POSIX_FADVISE* flag on the entire relation (each segment). The more usefull are probably *WILLNEED* and *DONTNEED* which push and pop blocks of each segments of a relation from page cache, respectively.

Each functions are call with at least a table name or an index name (or oid) as a parameter and walk each segment of the relation.


DOWNLOAD

========

You can grab the latest code with git::

   git clone git://git.postgresql.org/git/pgfincore.git
   or
   git://github.com/klando/pgfincore.git

Download the latest version: http://pgfoundry.org/frs/download.php/3186/pgfincore-v1.1.1.tar.gz


INSTALLATION

 

Preinstallation

Beside Postgres server package, this installation needs postgresql-devel module:

#yum install postgresql94-devel

Package installation

Login as root user:
export PATH=/usr/pgsql-94/bin:$PATH   # or Set the path to point the directory where pg_config seats.

Do the following steps:

 tar -xvf pgfincore-v1.1.1.tar.gz 
cd pgfincore-1.1.1
make clean
make
make install
Now connect to PG and run below command
postgres=# CREATE EXTENSION pgfincore;

The above steps tested on SL5,6, A.K.A. RHEL5/6, pg9.1/pg9.2/pg9.3/pg9.4