mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-17 19:13:16 +08:00
Synchronize chunk cache sizes
Specifically, flush the chunk multi-insert states when the number of it reaches the size of the chunk cache. Otherwise, the chunks corresponding to the multi-insert states go out of cache and have to be looked up again when the multi-insert state is flushed, which leads to a performance hit.
This commit is contained in:
parent
7c841b8d92
commit
296601b1d7
11
src/copy.c
11
src/copy.c
@ -263,6 +263,17 @@ TSCopyMultiInsertInfoIsFull(TSCopyMultiInsertInfo *miinfo)
|
|||||||
if (miinfo->bufferedTuples >= MAX_BUFFERED_TUPLES ||
|
if (miinfo->bufferedTuples >= MAX_BUFFERED_TUPLES ||
|
||||||
miinfo->bufferedBytes >= MAX_BUFFERED_BYTES)
|
miinfo->bufferedBytes >= MAX_BUFFERED_BYTES)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (hash_get_num_entries(miinfo->multiInsertBuffers) >= ts_guc_max_open_chunks_per_insert)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Flushing each multi-insert buffer will require looking up the
|
||||||
|
* corresponding chunk insert state in the cache, so don't accumulate
|
||||||
|
* more inserts than the cache can fit, to avoid thrashing.
|
||||||
|
*/
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user