Skip to content

[Feature Request] Optarg for .delete() and .update() with array of ids #3177

Closed

Description

@thelinuxlich

So we could do a complex query, for example using .eqJoin() and instead of deleting/updating one by one with .forEach(), update/delete everything at once.

Activity

  1. mlucy commented on Oct 10, 2014

    @mlucy
    Member

    Another option would be to finally do #2156 so that for_each can do multiple writes in parallel.

  2. thelinuxlich commented on Oct 10, 2014

    @thelinuxlich
    Author

    Close to that, but to update/delete a big batch at once would be much more effective

  3. danielmewes commented on Oct 10, 2014

    @danielmewes
    Member

    From the ReQL side this this already possible I think, by using variadic getAll. For example like this:

    r.table('test').getAll(
        r.args( ...eqJoin(...)('id').coerceTo('ARRAY') )).
        delete()
    

    I'm not sure how well this will actually be parallelized under the hood (@mlucy?).

  4. mlucy commented on Oct 10, 2014

    @mlucy
    Member

    Close to that, but to update/delete a big batch at once would be much more effective

    Even if you do a big batched delete, we break it up into smaller batches internally so that we don't block out other operations while it happens. I think a parallelized update inside for_each would be close as fast as a batched update. If we added a way for writes to be squashed together into batched writes while waiting for the btree, I think it would be just as fast.

    From the ReQL side this this already possible I think, by using variadic getAll.

    If the body of the for_each is simple, that works too, and should parallelize just fine. The problem with that approach is that you need to evaluate all of the rows you're operating on before you can start doing writes on the first one, which will slow things down a bit.

  5. added this to the subsequent milestone on Oct 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions