Relation Cache
pgpool-II 4.1.3 Documentation | |||
---|---|---|---|
Prev | Up | Chapter 7. Performance Considerations | Next |
Except in raw mode (see Section 3.3.2 ) or load_balance_mode is set to off, sometimes Pgpool-II needs to ask PostgreSQL to get meta information, such as whether a table is a temporary one or not. To get those information, Pgpool-II sends queries primary PostgreSQL which could be up to as many as 10 queries (in 4.1 or after, the number of queries has been decreased, it is not zero, however). To reduce the overhead, Pgpool-II maintains "relation cache". Next time same table is included in a query, Pgpool-II extracts the information from the cache.
There are some parameters to configure the relation cache. See relcache_expire , relcache_size , check_temp_table , check_unlogged_table for more details.
7.5.1. Shared Relation Cache
The relation cache basically lives in process private memory, which is bound to a process. So even if a relation cache is created to for a table, in different process the relation cache might not be created yet. After all, until a relation cache entry is created in all process, queries continue to sent to PostgreSQL . Pgpool-II 4.1 overcomes the issue by creating relation cache in shared memory. If a session creates a relation cache entry in the shared memory, other sessions will get the cache result by looking at the shared relation cache. See enable_shared_relcache configuration parameter section for more details. This feature is pretty effective and we recommend this feature be enabled.