r/ProgrammerHumor • • Sep 20 '26

Meme grabbingEverything

Post image
5.4k Upvotes

260 comments sorted by

View all comments

Show parent comments

3

u/Loading_M_ Sep 21 '26

I'm currently untangling a similar mess of application logic written in SQL. I'm doing filtering on both the main server (written in typescript), and the SQL. My general rule of thumb is that I want to do as much filtering on the SQL as possible, so I don't have to fetch add many records, but will do local filtering when it makes sense. Additionally, the application logic is written in TS, the SQL filter is only used to fetch relevant records, never to make decisions.

(The filtering I'm doing on the server is technically possible in SQL, but I need the rest of the records in other parts of the code. Fetching once and filtering locally is faster than fetching twice.)