Re: effective_cache_size

2018-11-05 Thread Peter Eisentraut
On 16/10/2018 17:38, Bruce Momjian wrote:
> diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
> index 2317e8b..e471d7f 100644
> --- a/src/backend/utils/misc/guc.c
> +++ b/src/backend/utils/misc/guc.c
> @@ -2987,10 +2987,9 @@ static struct config_int ConfigureNamesInt[] =
>  
>   {
>   {"effective_cache_size", PGC_USERSET, QUERY_TUNING_COST,
> - gettext_noop("Sets the planner's assumption about the 
> size of the disk cache."),
> - gettext_noop("That is, the portion of the kernel's disk 
> cache that "
> -  "will be used for PostgreSQL 
> data files. This is measured in disk "
> -  "pages, which are normally 8 
> kB each."),
> + gettext_noop("Sets the planner's assumption about the 
> size of the data cache."),
> + gettext_noop("That is, the size of the cache used for 
> PostgreSQL data files. "
> +  "This is measured in disk 
> pages, which are normally 8 kB each."),
>   GUC_UNIT_BLOCKS,
>   },
>   &effective_cache_size,

This change completely loses the context that this is the kernel's/host
system's memory size.  What is "data cache"?  I think this is a bad
change.  I know it's confusing, but the old description at least had
some basis in terms that are known to the user.

-- 
Peter Eisentraut  http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



Re: effective_cache_size

2018-11-05 Thread Bruce Momjian
On Mon, Nov  5, 2018 at 12:50:01PM +0100, Peter Eisentraut wrote:
> On 16/10/2018 17:38, Bruce Momjian wrote:
> > diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
> > index 2317e8b..e471d7f 100644
> > --- a/src/backend/utils/misc/guc.c
> > +++ b/src/backend/utils/misc/guc.c
> > @@ -2987,10 +2987,9 @@ static struct config_int ConfigureNamesInt[] =
> >  
> > {
> > {"effective_cache_size", PGC_USERSET, QUERY_TUNING_COST,
> > -   gettext_noop("Sets the planner's assumption about the 
> > size of the disk cache."),
> > -   gettext_noop("That is, the portion of the kernel's disk 
> > cache that "
> > -"will be used for PostgreSQL 
> > data files. This is measured in disk "
> > -"pages, which are normally 8 
> > kB each."),
> > +   gettext_noop("Sets the planner's assumption about the 
> > size of the data cache."),
> > +   gettext_noop("That is, the size of the cache used for 
> > PostgreSQL data files. "
> > +"This is measured in disk 
> > pages, which are normally 8 kB each."),
> > GUC_UNIT_BLOCKS,
> > },
> > &effective_cache_size,
> 
> This change completely loses the context that this is the kernel's/host
> system's memory size.  What is "data cache"?  I think this is a bad
> change.  I know it's confusing, but the old description at least had
> some basis in terms that are known to the user.

Well, the change as outlined in the email is that effective_cache_size
is a combination of shared_buffers and kernel cache size, which I think
the docs now make clear.  Do you have better wording for the GUC?

-- 
  Bruce Momjian  http://momjian.us
  EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+  Ancient Roman grave inscription +



Re: effective_cache_size

2018-11-05 Thread Nikolay Samokhvalov
On Mon, Nov 5, 2018 at 3:01 PM Bruce Momjian  wrote:

> > > {"effective_cache_size", PGC_USERSET, QUERY_TUNING_COST,
> > > -   gettext_noop("Sets the planner's assumption about
> the size of the disk cache."),
> > > -   gettext_noop("That is, the portion of the kernel's
> disk cache that "
> > > -"will be used for
> PostgreSQL data files. This is measured in disk "
> > > -"pages, which are
> normally 8 kB each."),
> > > +   gettext_noop("Sets the planner's assumption about
> the size of the data cache."),
> > > +   gettext_noop("That is, the size of the cache used
> for PostgreSQL data files. "
> > > +"This is measured in disk
> pages, which are normally 8 kB each."),
>
...

> Well, the change as outlined in the email is that effective_cache_size
> is a combination of shared_buffers and kernel cache size, which I think
> the docs now make clear.  Do you have better wording for the GUC?
>

Maybe it's better to use this phrase, "a combination of shared_buffers and
kernel cache size"?
Or: "a combination of shared_buffers and estimated kernel cache size".

The phrase "the size of the cache" might be very confusing indeed – it
sounds like it's about
some single cache, while it's about the combination of two.

Maybe it's also worth to mention that the fact that some pages might be
cached twice –
in OS cache + in Postgres shared buffers – should be ignored, when choosing
the proper value
for  effective_cache_size? I think this would finally eliminate the
possibility of confusion.

I see now, the docs chapter "19.7. Query Planning" has "some data might
exist in both places"
– this is great, since confusion here is not uncommon. It's worth to
propagate this change
everywhere where effective_cache_size is explained.

Nik


Re: effective_cache_size

2018-11-05 Thread Bruce Momjian
On Mon, Nov  5, 2018 at 03:23:03PM +0300, Nikolay Samokhvalov wrote:
> 
> 
> On Mon, Nov 5, 2018 at 3:01 PM Bruce Momjian  wrote:
> 
> > >             {"effective_cache_size", PGC_USERSET, QUERY_TUNING_COST,
> > > -                   gettext_noop("Sets the planner's assumption about
> the size of the disk cache."),
> > > -                   gettext_noop("That is, the portion of the kernel's
> disk cache that "
> > > -                                            "will be used for
> PostgreSQL data files. This is measured in disk "
> > > -                                            "pages, which are 
> normally
> 8 kB each."),
> > > +                   gettext_noop("Sets the planner's assumption about
> the size of the data cache."),
> > > +                   gettext_noop("That is, the size of the cache used
> for PostgreSQL data files. "
> > > +                                            "This is measured in disk
> pages, which are normally 8 kB each."),
> 
> ...
> 
> Well, the change as outlined in the email is that effective_cache_size
> is a combination of shared_buffers and kernel cache size, which I think
> the docs now make clear.  Do you have better wording for the GUC?
> 
> 
> Maybe it's better to use this phrase, "a combination of shared_buffers and
> kernel cache size"?
> Or: "a combination of shared_buffers and estimated kernel cache size".

Well, here are the lines in guc.c:

gettext_noop("Sets the planner's assumption about the size of the 
data cache."),
gettext_noop("That is, the size of the cache used for PostgreSQL 
data files. "
 "This is measured in disk pages, which are normally 8 
kB each."),

The first line is already on the long side compared to other entries, as
is the second gettext_noop().  How long can we make it without being too
long?  Is this really the place to explain this distinction?  I thought
about these issues when I wrote this patch?  You can come to a different
conclusion, but please consider these issues.

-- 
  Bruce Momjian  http://momjian.us
  EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+  Ancient Roman grave inscription +



Re: effective_cache_size

2018-11-05 Thread Alvaro Herrera
On 2018-Nov-05, Bruce Momjian wrote:

> Well, here are the lines in guc.c:
> 
> gettext_noop("Sets the planner's assumption about the size of the 
> data cache."),
> gettext_noop("That is, the size of the cache used for PostgreSQL 
> data files. "
>  "This is measured in disk pages, which are normally 
> 8 kB each."),

I suggest "the size of data caches", plural, in the first line (two
letters shorter, since I lost the article).  And in the second line, use
"... the size of the combined caches used for Pg data files, including
both the kernel cache and shared buffers" -- a few words longer, which
seems worth it to me.

-- 
Álvaro Herrerahttps://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services