Re: Do work_mem and shared buffers have 1g or 2g limit on 64 bit linux?
От | Tomas Vondra |
---|---|
Тема | Re: Do work_mem and shared buffers have 1g or 2g limit on 64 bit linux? |
Дата | |
Msg-id | 557EE7F1.9000901@2ndquadrant.com обсуждение исходный текст |
Ответ на | Re: Do work_mem and shared buffers have 1g or 2g limit on 64 bit linux? (Kaijiang Chen <chenkaijiang@gmail.com>) |
Список | pgsql-performance |
On 06/15/15 05:44, Kaijiang Chen wrote: > I've checked the source codes in postgresql 9.2.4. In function > static bool > grow_memtuples(Tuplesortstate *state) > > the codes: > /* > * On a 64-bit machine, allowedMem could be high enough to get us into > * trouble with MaxAllocSize, too. > */ > if ((Size) (state->memtupsize * 2) >= MaxAllocSize / sizeof(SortTuple)) > return false; > > Note that MaxAllocSize == 1GB - 1 > that means, at least for sorting, it uses at most 1GB work_mem! And > setting larger work_mem has no use at all... That's not true. This only limits the size of 'memtuples' array, which only stores pointer to the actual tuple, and some additional data. The tuple itself is not counted against MaxAllocSize directly. The SortTuple structure has ~24B which means you can track 33M tuples in that array, and the tuples may take a lot more space. regards -- Tomas Vondra http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-performance по дате отправления: