Re: Query in cache

From: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
To: Rogerio Pereira <rogerio(dot)pereira(at)riosoft(dot)com(dot)br>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Query in cache
Date: 2013-11-19 01:37:11
Message-ID: CAL_0b1t40UkK2JFBiR00oU1iXqbmvCe4dK+m1JpMWqDEHubaag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

2013/11/18 Rogerio Pereira <rogerio(dot)pereira(at)riosoft(dot)com(dot)br>
> I am need help, about subject "Query cache in Postgres".
> how is it possible to put sql statements cached in postgres ?
> I did some tests and I can not get even with improved tuning
> parameters in the postgresql.conf.

Are you talking about prepared statements or about query result caching?

If former then you need to look at the PREPARE for execute statement
[1], though it is probably implemented in your data adapter, for
example like it is in DBD::Pg [2]. Also take a look at the pre_prepare
module [3], that can conveniently be used with pgbouncer.

If later then there is an extension named pgmemcache [4] that will
allow you to interact with memcached directly from postgres, so you
could implement cashing in stored functions, for example. However my
advice is to use application level caching with memcached in this
case, not the database level one.

[1] http://www.postgresql.org/docs/9.3/static/sql-prepare.html
[2] http://search.cpan.org/dist/DBD-Pg/Pg.pm#prepare
[3] https://github.com/dimitri/preprepare
[4] https://github.com/ohmu/pgmemcache/

--
Kind regards,
Sergey Konoplev
PostgreSQL Consultant and DBA

http://www.linkedin.com/in/grayhemp
+1 (415) 867-9984, +7 (901) 903-0499, +7 (988) 888-1979
gray(dot)ru(at)gmail(dot)com

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message ktm@rice.edu 2013-11-19 14:00:44 Re: Query in cache
Previous Message salah jubeh 2013-11-19 00:36:20 Re: Query in cache