4 ms·
This is heresy and unbelievers will be punished! Seriously though, I agree whole heartedly and am often dismayed at the lengths developers will go through to no
by marktangotango 12y ago
This is heresy and unbelievers will be punished! Seriously though, I agree whole heartedly and am often dismayed at the lengths developers will go through to not write sql.
- vinceguidry 12y agoOh believe me, I tried to use Sequel to get that data. After I realized just how many joins and how many layers of abstraction I'd need to debug the damn thing through, I knuckled down and built the query. Even so it runs behind a caching layer. Thankfully, I don't need up-to-the-minute product data.
- marktangotango 12y agoAt one previous gig we had a product-god query similar to what you're describing, which was the source of neverending sorrow. Eventually, the solution was to write and schedule a stored procedure that built a 'current_product' table with essential fields. Products and catalogs weren't updated that frequently, so it ran nightly, or could be run on demand. Performance increase was immense.
- vinceguidry 12y agoMy problem was that there was so much baked in logic that I had to trace through the codebase to figure out, and even so, I was getting lots of incorrect results for months until I'd worked all the issues out. Even now sometimes my boss will be like, "there's bad data in the feed, can you check the query?" Most of the time it's bad data, but every time I have to load the damn query up in SequelPro and make sure it's doing its job. I dread the day when I actually have to understand what it's doing again.