Coder Social home page Coder Social logo

Limit on Update and Delete about crate HOT 4 CLOSED

crate avatar crate commented on September 23, 2024
Limit on Update and Delete

from crate.

Comments (4)

dobe avatar dobe commented on September 23, 2024

hi @herenow

yes, we currently have do not support limit on update and delete
see https://crate.io/docs/current/sql/reference/delete.html and https://crate.io/docs/current/sql/reference/update.html

can you tell me about the use-case you have to update delete with limit. we put this on our backlog - in order to prioritize this feature, it would be nice to hear such use-cases

thx, bernd

from crate.

herenow avatar herenow commented on September 23, 2024

Hi @dobe,

Just let me get something straight first, how does Crate know when to stop deleting or updating? If its searching with a 'primary key' it will by default stop matching once it has found one match? If its a normal search based on a normal index 'key' it will keep iterating the table until it has found all matches?

Sorry if I got the process wrong, i'm not sure how DB's generally work and match data. But as a developer, I generally put LIMIT's on my UPDATE's and DELETE's for performance reasons, considering if I don't the DB will keep trying to find more then one match.

from crate.

dobe avatar dobe commented on September 23, 2024

In crate, it is actually more work to apply a limit than without. This is due to the distributed nature of crate. A table is distributed across multiply shards from which all matching docs are updated or deleted. Implementing a limit clause would require some effort in order to not update/delete too many rows, since we cannot limit just by the value of the specified limit, because in the worst case it would delete num_shards*limit number of documents instead of just the specified limit.

However since this is only for performance - you don't need to specify the limit. I also think that for most databases this makes no difference in speed.

Actually, if crate sees that a full primary key is specified in the query part, the planner internally does a direct update of the row instead of a query automatically.

from crate.

herenow avatar herenow commented on September 23, 2024

Got it, thanks.

from crate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.