Reminded again why every professional developer should at least read and understand basic algorithms...

Colleague: I don't understand why this agregation query is so slow, the counting is on the DB.

This function used to work fine... Now it sometimes hangs.

Me thinking: why does everyone assume db has unlimited resources and computing power so everything should be quick (no time or space complexity)...

Maybe if everyone understood this stuff our code base wouldn't be so shitty from the start...

  • 1
    Math is hard, I don't get maths.
  • 1
    @N00bPancakes there's no math... Just that don't write shitty code and expect it to run fast forever and then ask why?
  • 3

    I especially hate this in the Ruby world because it makes writing O(n^2) complexity (and worse) so very easy.
  • 2
    Database is mostly set theory.

    When I throw 5 marbles at you and you need to sort by pain, you don't like it but it's fine.

    When I throw 5.000.000 marbles at you... Well. My throwing arm would rip off and you wouldn't be fine.

    - Resultset for dummies -
  • 2
    @IntrusionCM I can think of a lot of people I would happily throw 5,000,000 marbles at.
  • 1
    @Root @IntrusionCM why marbles and not baseballs?

    How do you even throw a marble... Usually need to shoot them otherwise weak?
  • 3
    Marble: 0-8 damage
    Baseball: 0-55 damage

    5,000,000*rand(8) might be less than the baseballs’ cap, but it’s still going to hurt. A lot.
  • 0
    @donuts @Root

    You've fallen into the trap.

    I said for dummies. Dummies do not ASK questions.

    You are not a dummy.

    So go figure it out by your self. :)
Add Comment