Does Postgres 14 have a query cache?

Started by Siddharth Jainabout 3 years ago8 messagesgeneral
Jump to latest
#1Siddharth Jain
siddhsql@gmail.com

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

[image: image.png]

Attachments:

image.pngimage/png; name=image.pngDownload+3-2
#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Siddharth Jain (#1)
Re: Does Postgres 14 have a query cache?

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.

David J.

Attachments:

image.pngimage/png; name=image.pngDownload+3-2
#3Peter J. Holzer
hjp-pgsql@hjp.at
In reply to: Siddharth Jain (#1)
Re: Does Postgres 14 have a query cache?

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!"

#4Christophe Pettus
xof@thebuild.com
In reply to: Peter J. Holzer (#3)
Re: Does Postgres 14 have a query cache?

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 identical queries and caching their results while maintaining good invalidation is a much harder problem.

#5Ron
ronljohnsonjr@gmail.com
In reply to: Siddharth Jain (#1)
Re: Does Postgres 14 have a query cache?

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.

Attachments:

image.pngimage/png; name=image.pngDownload+3-2
#6Steven Lembark
lembark@wrkhors.com
In reply to: Ron (#5)
Re: Does Postgres 14 have a query cache?

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

#7Siddharth Jain
siddhsql@gmail.com
In reply to: Steven Lembark (#6)
Re: Does Postgres 14 have a query cache?

Thanks all for the replies. Just wanted to confirm.

On Sat, Feb 18, 2023 at 10:45 AM Steven Lembark <lembark@wrkhors.com> wrote:

Show quoted text

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

#8Tatsuo Ishii
t-ishii@sra.co.jp
In reply to: David G. Johnston (#2)
Re: Does Postgres 14 have a query cache?

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