Remix.run Logo
luckylion 5 days ago

I feel like the biggest question to ask is: how expensive is it exactly, how often do you need to do it, and how important is the speed of it?

If you have some complex queries on every page load with a huge number of users, put it in the DB as much as possible.

If you need to iterate over a bunch of records and do something based on some combination of values, and it's for a weekly reporting thing, I'd much rather see 3 nested foreach loops with a lot of early exits to skip the things you don't care about than a multi-kb SQL-statement that took two days to develop and nobody every dares to touch again because it's hard to handle.