Thread: Does Postgres 14 have a query cache?

Does Postgres 14 have a query cache?

From
Siddharth Jain
Date:
I think the answer is no but wanted to confirm here. this is what my best friend told me.

image.png
Attachment

Re: Does Postgres 14 have a query cache?

From
"David G. Johnston"
Date:
On Sat, Feb 18, 2023 at 7:47 AM Siddharth Jain <siddhsql@gmail.com> wrote:
I think the answer is no but wanted to confirm here. this is what my best friend told me.

image.png

I find the last paragraph suspect.  The rest is basically correct.

David J.
Attachment

Re: Does Postgres 14 have a query cache?

From
"Peter J. Holzer"
Date:
On 2023-02-18 06:46:59 -0800, Siddharth Jain wrote:
> I think the answer is no but wanted to confirm here. this is what my best
> friend told me.
>
> image.png

ChatGPT is your best friend?

It is correct. PostgreSQL doesn't have a query cache. I think the reason
is that the use case (the exact same query is submitted repeatedly) is
sufficiently rare that it isn't all that effective in practice.

(The other techniques mentioned are of course also used by other
databases.)

        hp


--
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment

Re: Does Postgres 14 have a query cache?

From
Christophe Pettus
Date:

> On Feb 18, 2023, at 06:59, Peter J. Holzer <hjp-pgsql@hjp.at> wrote:
> I think the reason
> is that the use case (the exact same query is submitted repeatedly) is
> sufficiently rare that it isn't all that effective in practice.

And, in this use case, a prepared statement is in effect a cache of the parsing and planning of the query.  Detecting
identicalqueries and caching their results while maintaining good invalidation is a much harder problem. 



Re: Does Postgres 14 have a query cache?

From
Ron
Date:
It's got buffers.  If you frequently query the same lookup tables, they'll stay in memory...

On 2/18/23 08:46, Siddharth Jain wrote:
I think the answer is no but wanted to confirm here. this is what my best friend told me.

image.png

--
Born in Arizona, moved to Babylonia.
Attachment

Re: Does Postgres 14 have a query cache?

From
Steven Lembark
Date:
On Sat, 18 Feb 2023 12:43:42 -0600
Ron <ronljohnsonjr@gmail.com> wrote:

> > I think the answer is no but wanted to confirm here. this is what
> > my best friend told me.

There are caches for prepared statements, table rows, indexes. 

What about the caches are you interested in?


-- 
Steven Lembark
Workhorse Computing
lembark@wrkhors.com
+1 888 359 3508



Re: Does Postgres 14 have a query cache?

From
Siddharth Jain
Date:
Thanks all for the replies. Just wanted to confirm. 

On Sat, Feb 18, 2023 at 10:45 AM Steven Lembark <lembark@wrkhors.com> wrote:
On Sat, 18 Feb 2023 12:43:42 -0600
Ron <ronljohnsonjr@gmail.com> wrote:

> > I think the answer is no but wanted to confirm here. this is what
> > my best friend told me.

There are caches for prepared statements, table rows, indexes.

What about the caches are you interested in?


--
Steven Lembark
Workhorse Computing
lembark@wrkhors.com
+1 888 359 3508


Re: Does Postgres 14 have a query cache?

From
Tatsuo Ishii
Date:
> On Sat, Feb 18, 2023 at 7:47 AM Siddharth Jain <siddhsql@gmail.com> wrote:
> 
>> I think the answer is no but wanted to confirm here. this is what my best
>> friend told me.
>>
>> [image: image.png]
>>
> 
> I find the last paragraph suspect.  The rest is basically correct.

Yeah. Pgpool-II has query cache but PgBouncer does not.

Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp