Replies: 1 comment
-
I'm going to close this because I—of course—found a great resource that explains all of that minutes after opening this issue. If you want to know more about this topic watch jackc's talk about batched statements here: https://www.youtube.com/watch?v=sXMSWhcHCf8&t=1904s (Timestamped link) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I've been reading through the issues and documentation, and I'm a bit confused about how
Batch
is supposed to work. My use case is the following:I have a slice of items that I want to insert, some of them might return an error, some of them will hit a constraint (
pq: duplicate key value violates unique constraint
). I want to ignore constraint violations, and I want to log other errors.After reading #879 I believe this might not work, as a single constraint violation will roll back all inserts, is that a correct assumption? Is
Batch
the wrong tool for the job? I've previously just looped over the slice and done separate requests (via sqlx), but I'm trying to optimize that flow by using pgx's batching support.Thank you!
Beta Was this translation helpful? Give feedback.
All reactions