DEV Community

Discussion on: You Can Do it in SQL, Stop Writing Extra Code for it

 
rhymes profile image
rhymes • Edited

No, I get it, I see how it is both useful and how it might be obscure even to those that write some SQL.

It took me a while to get it but I was actually writing a basic leaderboard and all of the "in language" solutions I tried were dog slow. Window functions instead use indexes :)

I'm also in the camp that says SQL is over used.

I don't know, it really depends on too many factors.

The two popular and malignant ways it's overused is when one DB is shared between many if not all microservices (regardless of how well written the stored procedures are),

Eh eh yeah, say no to stored procedures 99.99% of the time. The only placed I worked at where we had those was at a financial company and they used procedures written in Python that did math calculations inside the DB. A mess to maintain but insanely fast.

Say no to microservices that synchronize through a shared DB. That's a distributed monolith :D

Thread Thread
 
qm3ster profile image
Mihail Malo

I meant stored procedures in SQL itself. CREATE PROCEDURE.

Thread Thread
 
rhymes profile image
rhymes

Yeah, let's avoid stored procedures if we can. Agreed