Best practices when using Appender API #277
Answered
by
taniabogatsch
charlespnh
asked this question in
Q&A
-
I have an use case to handle traffic data and since it'll be write-heavy the Appender API is suitable for this. The traffic data will be parsed and inserted into 3 tables, so I'll have to create 3 appenders. I have a few questions regarding the best practices of using the Appender API in my particular cases:
Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
taniabogatsch
Sep 20, 2024
Replies: 1 comment 1 reply
-
I haven't used the appender in production, but I've worked with others asking the same questions. So, my answer might not work perfectly for your use case, but it could be seen as an indication.
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
charlespnh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I haven't used the appender in production, but I've worked with others asking the same questions. So, my answer might not work perfectly for your use case, but it could be seen as an indication.
Appender
should have its own connection. You limit parallelism if you create them on the same connection. Within a connection, DuckDB does not parallelize between append operations. So you'll end up appending to the (different) tables sequentially.Appender
is supposed to be short-lived. I.e., you get a connection from the pool, create the appender, append your data, close the appender, and then release the connection back into the pool.2.1. Creating connections is very lightweight in d…