mirror of
https://github.com/postgres/postgres.git
synced 2025-12-06 00:02:13 +03:00
In COPY, insert tuples to the heap in batches.
This greatly reduces the WAL volume, especially when the table is narrow. The overhead of locking the heap page is also reduced. Reduced WAL traffic also makes it scale a lot better, if you run multiple COPY processes at the same time.
This commit is contained in:
@@ -1677,10 +1677,10 @@ add_tabstat_xact_level(PgStat_TableStatus *pgstat_info, int nest_level)
|
||||
}
|
||||
|
||||
/*
|
||||
* pgstat_count_heap_insert - count a tuple insertion
|
||||
* pgstat_count_heap_insert - count a tuple insertion of n tuples
|
||||
*/
|
||||
void
|
||||
pgstat_count_heap_insert(Relation rel)
|
||||
pgstat_count_heap_insert(Relation rel, int n)
|
||||
{
|
||||
PgStat_TableStatus *pgstat_info = rel->pgstat_info;
|
||||
|
||||
@@ -1693,7 +1693,7 @@ pgstat_count_heap_insert(Relation rel)
|
||||
pgstat_info->trans->nest_level != nest_level)
|
||||
add_tabstat_xact_level(pgstat_info, nest_level);
|
||||
|
||||
pgstat_info->trans->tuples_inserted++;
|
||||
pgstat_info->trans->tuples_inserted += n;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user