Skip to content

Commit 2c71a2b

Browse files
committed
add comments for the COPY queue size parameters
1 parent c896d4e commit 2c71a2b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

db-copy.hpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,22 @@ class db_cmd_t
6767

6868
struct db_cmd_copy_t : public db_cmd_t
6969
{
70-
enum { Max_buf_size = 10 * 1024 * 1024, Max_buffers = 10 };
70+
enum {
71+
/** Size of a single buffer with COPY data for Postgresql.
72+
* This is a trade-off between memory usage and sending large chunks
73+
* to speed up processing. Currently a one-size fits all value.
74+
* Needs more testing and individual values per queue.
75+
*/
76+
Max_buf_size = 10 * 1024 * 1024,
77+
/** Maximum length of the queue with COPY data.
78+
* In the usual case, PostgreSQL should be faster processing the
79+
* data than it can be produced and there should only be one element
80+
* in the queue. If PostgreSQL is slower, then the queue will always
81+
* be full and it is better to keep the queue smaller to reduce memory
82+
* usage. Current value is just assumed to be a reasonable trade off.
83+
*/
84+
Max_buffers = 10
85+
};
7186
/// Name of the target table for the copy operation
7287
std::shared_ptr<db_target_descr_t> target;
7388
/// Vector with object to delete before copying

0 commit comments

Comments
 (0)