38

> TeamLeader1: I just discovered SQL is actually super fast! The low responsiveness I've experienced comes from our ORM!
> IHateForALiving: well of course SQL is blazingly fast. SQL has been refined by the best engineers in the world for the past 50 years, its performances are unparalleled for everything you could possibly need, unless you want to scale REALLY big. Sequelize, instead, is an Active Record ORM, so it's bound to struggle with huge amount of data, because every single row will get attached a significant amount of black magic to make sure everything syncs correctly. Why is that?
> TeamLeader1: I have a problem with this frontend component, it doesn't allow pagination. I tried downloading the whole DB to bypass that, but the ORM is slow... so I will bypass the ORM and download the whole table with a raw query. Look at that! It works like a charm, it's super duper fast!'

This mf is downloading some 35 thousand rows every time some user loads a page because he doesn't know how to paginate the fucking table with Angular, there's no way these people are real.

Comments
  • 18
    been there, refactored that.

    to be honest, on a "shocking"-scale of 1-10, this is just maybe 4 or 5 to me.
  • 7
    The other side of this:
    Ok. We have a static 150kloc CSV file, that we want to be able to query randomly.
    Is the data set updatable? no.
    will any records be deleted? no.
    Are the queris static? yes.
    Are we going to do anything else with this in the next 5 years? no.

    So CRUD, without the C, U or D?
    Simple solution: memory resident sqlite database. memory footprint of 30mb. With a bit of sql written.

    TL during Code Review: Why no ORM?
    Me: 😵
  • 1
    @magicMirror why sql at all? O.o
  • 1
    A few years ago I tried this in a fresh sandbox project with PHP:
    - native SQL: 30ms
    - ORM (same data): 300ms

    We are ORMless btw :)
  • 4
    The problem I was highlighting wasn't ORM vs non-ORM; the problem I was highlighting was downloading the whole fucking db because you can't use a component in Angular.

    As for ORMs, they are tools. You need to know when to hold them and when to fold them. You say PHP and, given the slowness, I take it you're using Eloquent, it's an Active Record (and a bad one at that too), so it's doomed to be slow. Data Mappers are much more reasonable and work fine for 99% of your use cases, really.
  • 2
    This makes me feel more confident, thank you
  • 0
    Do you live in the first world? If so, I bet this person makes like ten times what I make.
  • 1
    @tosensei you must have seen some shit...
  • 2
    Man, if I had a nickel for each time a dumbass JavaScript junkie couldn't be fucked except to do pagination in the front end.
  • 1
    Why are these people team leads?
  • 0
    @iiii
    Need to query the data on 3 columns, one is a possible partial string match.
    Sql? yes.
    Custom solution? Noooooooo. Fuck that.
  • 1
    @yamlbreakfast i've seen changes in styling break stuff in the database.

    nuff said.
Add Comment