Re: proposal: Set effective_cache_size to greater of .conf value, shared_buffers

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, Magnus Hagander <magnus(at)hagander(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Claudio Freire <klaussfreire(at)gmail(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: Set effective_cache_size to greater of .conf value, shared_buffers
Date: 2014-05-06 21:54:19
Message-ID: CA+TgmoY1xrxoYn8Y_kk6zpGC=ZpFjjWFsiPENCGNCnLk95BM3g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 6, 2014 at 4:38 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
> I read the code, think what to say and then say what I think, not
> rely on dogma.
>
> I tried to help years ago by changing the docs on e_c_s, but that's
> been mostly ignored down the years, as it is again here.

Well, for what it's worth, I've encountered systems where setting
effective_cache_size too low resulted in bad query plans, but I've
never encountered the reverse situation. My personal sample size is
pretty small, though. And, when I did a study of 100+
pgsql-performance reports for last year's PGCon talk, I didn't turn up
any that seemed related to effective_cache_size. Here's the subset of
those reports that appeared settings-related:

https://sites.google.com/site/robertmhaas/query-performance/settings

I think the basic problem with effective_cache_size is that it's a
pretty weak knob. I don't think it's a secret that we more often
seq-scan when we should have index-scanned than the other other way
around. So if I had to hard-code a value for effective_cache_size,
I'd probably pick positive infinity. Yeah, that could be overkill -
but I bet I'd be able to compensate by frobbing seq_page_cost and
random_page_cost in a pinch.

I basically think the auto-tuning we've installed for
effective_cache_size is stupid. Most people are going to run with
only a few GB of shared_buffers, so setting effective_cache_size to a
small multiple of that isn't going to make many more people happy than
just raising the value - say from the current default of 128MB to, oh,
4GB - especially because in my experience queries aren't very
sensitive to the exact value; it just has to not be way too small. I
bet the number of PostgreSQL users who would be made happy by a much
higher hard-coded default is not too different from the number that
will be made happy by the (completely unprincipled) auto-tuning.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2014-05-06 22:07:57 Re: proposal: Set effective_cache_size to greater of .conf value, shared_buffers
Previous Message Tom Lane 2014-05-06 21:35:15 Re: [COMMITTERS] pgsql: pgindent run for 9.4