r/developersIndia • u/dronzer7716 • Jan 16 '24
Tips Optimizing SQL Queries by 23x!!!
This was the first time that I wrote an article about a thing that I was working on, and this was the very first time something like this was assigned to me and I was very excited to investigate and find potential improvements, Wrote an article about it hope you guys will also find it useful.
62
Upvotes
View all comments
Show parent comment
6
u/Beginning-Ladder6224 Jan 16 '24
That was always the case. I guess everyone understands that.
GOTO was never evil.
Be careful while jumping out of 4th floor.
No. Just say - "Jumping out of any floor is a bad idea".
Cigarettes causes cancer.
All of them are ONLY mostly accurately statistically valid.
"Likely to cause" is what gets replaced by a blanket statement "causes" because well, people will NOT pay notice at all UNLESS you go blatant.
Yes, that is a blatant disregard to "underlying SQL Algebra" and "stochastic nature of data modelling".
Most SQL systems scale by simply abandoning the "join" properties, which was a terrible idea from an execution standpoint - UNLESS - and here comes the UNLESS join can be done in linear complexity over the length of the two tables.
Try implement a join by hand - a very interesting question I generally give to all the "data folks".
For a data set that will go in million even for a tier 10 company not even having 2 users per day - joins stays BAD BAD BAD.
https://www.seas.upenn.edu/~zives/03f/cis550/codd.pdf
https://stackoverflow.com/questions/5557964/perform-joins-in-on-time
https://www.linkedin.com/pulse/four-papers-laid-out-foundation-big-data-nosql-hasan-karakulah/