pgsql: tableam: Add table_multi_insert() and revamp/speed-up COPYFROM
От | Andres Freund |
---|---|
Тема | pgsql: tableam: Add table_multi_insert() and revamp/speed-up COPYFROM |
Дата | |
Msg-id | E1hCBpE-0005Ib-9C@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
tableam: Add table_multi_insert() and revamp/speed-up COPY FROM buffering. This adds table_multi_insert(), and converts COPY FROM, the only user of heap_multi_insert, to it. A simple conversion of COPY FROM use slots would have yielded a slowdown when inserting into a partitioned table for some workloads. Different partitions might need different slots (both slot types and their descriptors), and dropping / creating slots when there's constant partition changes is measurable. Thus instead revamp the COPY FROM buffering for partitioned tables to allow to buffer inserts into multiple tables, flushing only when limits are reached across all partition buffers. By only dropping slots when there've been inserts into too many different partitions, the aforementioned overhead is gone. By allowing larger batches, even when there are frequent partition changes, we actuall speed such cases up significantly. By using slots COPY of very narrow rows into unlogged / temporary might slow down very slightly (due to the indirect function calls). Author: David Rowley, Andres Freund, Haribabu Kommi Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de https://postgr.es/m/20190327054923.t3epfuewxfqdt22e@alap3.anarazel.de Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/86b85044e823a304d2a265abc030254d39efe7df Modified Files -------------- src/backend/access/heap/heapam.c | 23 +- src/backend/access/heap/heapam_handler.c | 1 + src/backend/commands/copy.c | 888 +++++++++++++++++++------------ src/backend/executor/execMain.c | 1 + src/backend/executor/execPartition.c | 1 + src/include/access/heapam.h | 6 +- src/include/access/tableam.h | 26 + src/include/nodes/execnodes.h | 4 + src/tools/pgindent/typedefs.list | 3 + 9 files changed, 587 insertions(+), 366 deletions(-)
В списке pgsql-committers по дате отправления: