[pgpool-general: 7568] Re: A question about how do pgpool handle concurrent SAME sql

Bo Peng pengbo at sraoss.co.jp
Wed May 12 17:13:39 JST 2021


Hi,

On Wed, 12 May 2021 02:19:03 +0000
chen dean <dadiorchen at outlook.com> wrote:

> In my case, it's possible that a lot of the same SQL queries happen at the same time, so I want to ask that if this thing happens, how pgpool handle it? Will pgpool request a lot of the same queries to the backend postgresql server or, 

Yes.
By default, Pgpool-II will send all the queries to PostgreSQL.

> it will queue all those same queries and responds when just one query gets finished from the server?
> Thanks, I'm considering using pgpool as a SQL cache for my project, in greenstand.org

If you enable "in memory cache", Pgpool-II will return the result from cache instead of accessing PostgreSQL.

To enable "in memory cache", you need to configure the following parameter:

  memory_cache_enabled = on

For more informatoin:
  
  https://www.pgpool.net/docs/latest/en/html/runtime-in-memory-query-cache.html

In memory cache saves the pair of SELECT statement and its result (along with the Bind parameters, if the SELECT is an extended query). If the same SELECTs comes in, Pgpool-II returns the value from cache. Since no SQL parsing nor access to PostgreSQL are involved, the serving of results from the in memory cache is extremely fast. 

> 
> Dadior Chen


-- 
Bo Peng <pengbo at sraoss.co.jp>
SRA OSS, Inc. Japan


More information about the pgpool-general mailing list