Giter VIP home page Giter VIP logo

Comments (7)

magnusvk avatar magnusvk commented on May 24, 2024

This problem is much reduced with a927a23; that commit makes sure we pull both the correct and incorrect counts in one query. However, any additions / deletions between then and the later update would still cause a disparity. In any case, we are certainly better off.

from counter_culture.

xtagon avatar xtagon commented on May 24, 2024

Would changing it to do an update_all with a JOIN help out with #79 at all?

Even though that issue was closed, it is actually still a pressing issue for me and I haven't found a suitible solution yet.

from counter_culture.

magnusvk avatar magnusvk commented on May 24, 2024

@xtagon I'm not sure what you mean to be honest.

from counter_culture.

xtagon avatar xtagon commented on May 24, 2024

Maybe we can use an update_all with a JOIN to let the database handle this atomically? Might this also be faster?

@magnusvk I was hoping this meant counter_culture_fix_counts would be faster in that case

from counter_culture.

magnusvk avatar magnusvk commented on May 24, 2024

@xtagon it uses update_all: https://github.com/magnusvk/counter_culture/blob/master/lib/counter_culture/reconciler.rb#L118

from counter_culture.

xtagon avatar xtagon commented on May 24, 2024

@magnusvk Yes it does, but it does 1 update_all per primary key, so it's effectively a singular update.

In the end I was able to do a single update_all to compute counts for a table of millions of records in under a minute, but my use case is very simplified compared to what counter_culture supports so I can see how that would be hard to add to the library (with things like soft deletion, advanced associations, etc.)

from counter_culture.

magnusvk avatar magnusvk commented on May 24, 2024

Great, glad you could get it resolved. :)

from counter_culture.

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.