Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Bulk Insert: Reuse indexes for unique_by #35546
This has the added benefit of raising if no index is found, such that
boblail left a comment
(Also, I didn't know about
I've got two questions about the API:
is kind of a wordy parameter name. Do we need to add
Does it make sense to support both ways of specifying an index? We could reuse remove_index's API here to increase predictability:
If wanted to support both, but departed a little from
(Note: in this scenario, we're dropping support for
Lastly, should we loop @dhh in on the conversation? He weighed in pretty heavily on the API of the original PR.
True, the parameter name is too wordy. I've been thinking we just go with
Though it is tough to say which expect should be stressed more. Is it the duplicate check or is it the aspect that the check is done with an index? I do like the latter because it hints of the performance aspect e.g. if you're inserting 100.000 rows into an already large table, you'd want to check the index performance first.
I'm pretty happy with this. I'm still open to other names and I'm going to do a final documentation pass tomorrow.
I've also killed the sort I had on the
Went back to our first love:
@boblail I was honestly very surprised that insert_all/upsert_all matches every unique index by default. I thought it was just the primary key index that was used! And that