Re: PG as in-memory db? How to warm up and re-populate buffers? How to read in all tuples into memory? - Mailing list pgsql-performance

From Claudio Freire
Subject Re: PG as in-memory db? How to warm up and re-populate buffers? How to read in all tuples into memory?
Date
Msg-id CAGTBQpbANDnewEMVBoFN0ZNtm6wvTUFH1nq6PdiQ7fnRMRjM1g@mail.gmail.com
Whole thread Raw
In response to Re: PG as in-memory db? How to warm up and re-populate buffers? How to read in all tuples into memory?  (Peter van Hardenberg <pvh@pvh.ca>)
Responses Re: PG as in-memory db? How to warm up and re-populate buffers? How to read in all tuples into memory?  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-performance
On Thu, Mar 1, 2012 at 9:28 PM, Peter van Hardenberg <pvh@pvh.ca> wrote:
>> Setting work_mem to hundreds of MB in a 4G system is suicide. Tens
>> even is dangerous.
>>
>
> Why do you say that? We've had work_mem happily at 100MB for years. Is
> there a particular degenerate case you're concerned about?

Me too.

But I've analyzed the queries I'll be sending to the database and I've
carefully bound the effective amount of memory used given the load
I'll be experiencing.

Saying that it should be set to 100M without consideration for those
matters is the suicide part. work_mem applies to each sort operation.
Suppose, just for the sake of argument, that each connection is
performing 5 such sorts (ie, 5 joins of big tables - not unthinkable),
then suppose you have your max_connections to the default of 100, then
the system could request as much as 50G of ram.

I set work_mem higher in my database system since I *know* most of the
connections will not perform any merge or hash joins, nor will they
sort the output, so they won't use work_mem even once. The ones that
will, I have limited on the application side to a handful, hence I
*know* that 50G theoretical maximum will not be reached.

Can the OP say that? I have no reason to think so. Hence I don't
suggest 100M is OK on a 4G system.

pgsql-performance by date:

Previous
From: Jeff Janes
Date:
Subject: Re: PG as in-memory db? How to warm up and re-populate buffers? How to read in all tuples into memory?
Next
From: Tomas Vondra
Date:
Subject: Re: [PERFORM] Re: [PERFORM] Re: [PERFORM] Re: [PERFORM] Re: 回复: [PERFORM] PG as in-memory db? How to warm up and re-populate buffers? How to read in all tuples into memory?