pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aaron Werman <awerman2@hotmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: Caching of Queries
Date: Tue, 28 Sep 2004 10:36:03 -0400
Message-ID: <BAY18-DAV2kUD5euwdU00080990@hotmail.com> (raw)
References: <b3dc511704092212502a2ddb09@mail.gmail.com>
	<20040923152925.18234.qmail@web41114.mail.yahoo.com>
	<20040927191836.GS1297@decibel.org>
	<00b201c4a4ff$bd73b8b0$7201a8c0@mst1x5r347kymb>
	<9617.1096341460@sss.pgh.pa.us>
	<BAY18-DAV126nx8dyDd000801d8@hotmail.com>
	<14083.1096379881@sss.pgh.pa.us>


----- Original Message ----- 
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "Aaron Werman" <awerman2@hotmail.com>
Cc: "Iain" <iain@mst.co.jp>; "Jim C. Nasby" <decibel@decibel.org>;
<pgsql-performance@postgresql.org>
Sent: Tuesday, September 28, 2004 9:58 AM
Subject: Re: [PERFORM] Caching of Queries


> "Aaron Werman" <awerman2@hotmail.com> writes:
> > I imagine a design where a shared plan cache would consist of the plans,
> > indexed by a statement hash and again by dependant objects.  A statement
to
> > be planned would be hashed and matched to the cache. DDL would need to
> > synchronously destroy all dependant plans. If each plan maintains a
validity
>   ^^^^^^^^^^^^^
> > flag, changing the cache wouldn't have to block so I don't see where
there
>                            ^^^^^^^^^^^^^^^^^^^^^^
> > would be contention.
>
> You have contention to access a shared data structure *at all* -- for
> instance readers must lock out writers.  Or didn't you notice the self-
> contradictions in what you just said?
>
> Our current scalability problems dictate reducing such contention, not
> adding whole new sources of it.

You're right - that seems unclear. What I meant is that there can be a
global hash table that is never locked, and the hashes point to chains of
plans that are only locally locked for maintenance, such as gc and chaining
hash collisions. If maintenance was relatively rare and only local, my
assumption is that it wouldn't have global impact.

The nice thing about plan caching is that it can be sloppy, unlike block
cache, because it is only an optimization tweak. So, for example, if the
plan has atomic refererence times or counts there is no need to block, since
overwriting is not so bad. If the multiprocessing planner chains the same
plan twice, the second one would ultimately age out....

/Aaron

>
> regards, tom lane
>



view thread (72+ messages)  latest in thread

Message-ID: <BAY18-DAV2kUD5euwdU00080990@hotmail.com>
Permalink:  ../BAY18-DAV2kUD5euwdU00080990@hotmail.com/
Also on:    postgresql.org/message-id/BAY18-DAV2kUD5euwdU00080990@hotmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: awerman2@hotmail.com, tgl@sss.pgh.pa.us
  Subject: Re: Caching of Queries
  In-Reply-To: <BAY18-DAV2kUD5euwdU00080990@hotmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox