pgsql: Remove size increase in ExprEvalStep caused by hashed saops

Поиск
Список
Период
Сортировка
От David Rowley
Тема pgsql: Remove size increase in ExprEvalStep caused by hashed saops
Дата
Msg-id E1o8zea-001RkN-OC@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Remove size increase in ExprEvalStep caused by hashed saops

50e17ad28 increased the size of ExprEvalStep from 64 bytes up to 88 bytes.
Lots of effort was spent during the development of the current expression
evaluation code to make an instance of this struct as small as possible.
Making this struct larger than needed reduces CPU cache efficiency during
expression evaluation which causes noticeable slowdowns during query
execution.

In order to reduce the size of the struct, here we remove the fn_addr
field. The values from this field can be obtained via fcinfo, just with
some extra pointer dereferencing. The extra indirection does not seem to
cause any noticeable slowdowns.

Various other fields have been moved into the ScalarArrayOpExprHashTable
struct. These fields are only used when the ScalarArrayOpExprHashTable
pointer has already been dereferenced, so no additional pointer
dereferences occur for these. Here we also make hash_fcinfo_data the last
field in ScalarArrayOpExprHashTable so that we can avoid a further pointer
dereference to get the FunctionCallInfoBaseData. This also saves a call to
palloc().

50e17ad28 was added in 14, but it's too late to adjust the size of the
ExprEvalStep in that version, so here we just backpatch to 15, which is
currently in beta.

Author: Andres Freund, David Rowley
Discussion: https://postgr.es/m/20220616233130.rparivafipt6doj3@alap3.anarazel.de
Backpatch-through: 15

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fe3caa1439378830d13423939b13e39d5afa8cf0

Modified Files
--------------
src/backend/executor/execExpr.c       | 19 +------------------
src/backend/executor/execExprInterp.c | 26 +++++++++++++++++++++-----
src/include/executor/execExpr.h       |  7 +------
3 files changed, 23 insertions(+), 29 deletions(-)


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Refactor sending of DataRow messages in replication protocol
Следующее
От: David Rowley
Дата:
Сообщение: pgsql: Remove size increase in ExprEvalStep caused by hashed saops