Delete multiple files with id
Hello Team
Can I update function to delete multiple files with id ?
6 Replies
is this performant for 1000s of records?
I wouldn't pass in a list of ids for more than a small number of items - probably works fine into the hundreds, just not a normal pattern and a lot to send over the wire. More typically you'll want to use an indexed query to retrieve the items you want to delete. For thousands of records you'll probably want to paginate and break up the operation into multiple mutations, but I don't know where the boundary is honestly. In my experience low thousands of write operations risks timing out the function, but things are faster now so that may have changed.
cc/ @Lee in case you have any rough numbers that would be relevant
i would limit it at about 1000. no hard numbers though
Since convex is not relational, I assume there is no equivalent for "on delete: cascade"?
Convex is definitely relational! It just doesn't have certain relational behaviors found in traditional dbs and ORMs built in to its core, instead it provides low level functionality so things like cascading deletes can happen in the software layer.
Ents is one good example of that, a library by a Convex team member that implements a lot of typical relational behavior for Convex, including cascading deletes: https://labs.convex.dev/convex-ents/schema/deletes
Cascading Deletes - Convex Ents
Relations, default values, unique fields and more for Convex