Re: Linux max on shared buffers?

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Curt Sampson <cjs(at)cynic(dot)net>
Cc: GB Clark <postgres(at)vsservices(dot)com>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, glenebob(at)nwlink(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: Linux max on shared buffers?
Date: 2002-07-19 14:41:28
Message-ID: 3D382518.CCF54B48@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Curt Sampson wrote:
>
> On Wed, 17 Jul 2002, GB Clark wrote:
>
> > Not all platforms have mmap. This has been discussed before I belive.
>
> I've now heard several times here that not all platforms have mmap
> and/or mmap is not compatable across all platforms. I've yet to
> see any solid evidence of this, however, and I'm inclined to believe
> that mmap compatability is no worse than compatability with the
> system V shared memory we're using already, since both are fairly
> specifically defined by POSIX.

Curt,

I still don't completely understand what you are proposing. What I
understood so far is that you want to avoid double buffering (OS buffer
plus SHMEM). Wouldn't that require that the access to a block in the
file (table, index, sequence, ...) has to go directly through a mmapped
region of that file?

Let's create a little test case to discuss. I have two tables, 2
Gigabyte in size each (making 4 segments of 1 GB total) plus a 512 MB
index for each. Now I join them in a query, that results in a nestloop
doing index scans.

On a 32 bit system you cannot mmap both tables plus the indexes at the
same time completely. But the access of the execution plan is reading
one tables index, fetching the heap tuples from it by random access, and
inside of that loop doing the same for the second table. So chances are,
that this plan randomly peeks around in the entire 5 Gigabyte, at least
you cannot predict which blocks it will need.

So far so good. Now what do you map when? Can you map multiple
noncontigous 8K blocks out of each file? If so, how do you coordinate
that all backends in summary use at maximum the number of blocks you
want PostgreSQL to use (each unique block counts, regardless of how many
backends have it mmap()'d, right?). And if a backend needs a block and
the max is reached already, how does it tell the other backends to unmap
something?

I assume I am missing something very important here, or I am far off
with my theory and the solution looks totally different. So could you
please tell me how this is going to work?

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephane Bortzmeyer 2002-07-19 14:44:40 Re: Looking for types: phone number, email addresses
Previous Message Oliver Elphick 2002-07-19 14:40:36 Re: Looking for types: phone number, email addresses