Should CreateExprContext() be using ALLOCSET_DEFAULT_SIZES?

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Should CreateExprContext() be using ALLOCSET_DEFAULT_SIZES?
Дата
Msg-id 20230217040131.5jtdaybrpld4my25@awork3.anarazel.de
обсуждение исходный текст
Ответы Re: Should CreateExprContext() be using ALLOCSET_DEFAULT_SIZES?
Список pgsql-hackers
Hi,

The thread around https://postgr.es/m/CADUqk8Uqw5QaUqLdd-0SBCvZVncrE3JMJB9+yDwO_uMv_hTYCg@mail.gmail.com
reminded me of the following:

ISTM that we really shouldn't use ALLOCSET_DEFAULT_SIZES for expression
contexts, as they most commonly see only a few small, or no, allocations.

That's true for OLTPish queries, but is is very often true even for analytics
queries.

Just because I had it loaded, here's the executor state for TPCH-Q01, which is
pretty expression heavy:

ExecutorState: 65536 total in 4 blocks; 42512 free (11 chunks); 23024 used
  TupleSort main: 32832 total in 2 blocks; 7320 free (7 chunks); 25512 used
    TupleSort sort: 8192 total in 1 blocks; 7928 free (0 chunks); 264 used
      Caller tuples: 8192 total in 1 blocks (9 chunks); 6488 free (0 chunks); 1704 used
  ExprContext: 8192 total in 1 blocks; 7928 free (0 chunks); 264 used
  ExprContext: 8192 total in 1 blocks; 7928 free (0 chunks); 264 used
  ExprContext: 8192 total in 1 blocks; 7928 free (0 chunks); 264 used
Grand total: 139328 bytes in 11 blocks; 88032 free (18 chunks); 51296 used

As you can see very little was allocated in the ExprContext's.


ISTM that we could save a reasonable amount of memory by using a smaller
initial size.

Not so sure if a smaller max size should be used though.

Greetings,

Andres Freund



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Reducing System Allocator Thrashing of ExecutorState to Alleviate FDW-related Performance Degradations
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal: psql: psql variable BACKEND_PID