Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
sssssss13192284dshit 😁😁😁😁 made my day. big thank you
lotd8970284dSo, selecting users with photos.path plus roles & permissions joining where in pivot role is too much? :p
Root32913284d@codeStalker good luck keeping people around if your database grows in complexity.
@Ashkin actually am working on a project now, and I purposely work hard towards doing less joins. I use these normalisation stuff i learnt during my masters to accomplish this. But today I had to perform 3 Joins which I thought so much of alternative solutions.
Conc. It's fine but too much joins make things difficult to understand. It's like trying to understand a pointer to pointer to a pointer 😡
Downside too is, you can't avoid joins if your tables are truly normalised.
It's good practice to limit joins as much as possible -- and subqueries, too. If you do this, your queries will be cleaner, faster, and easier to understand.
However, it's not always possible, especially on complex databases or when everything is nicely separated.
For example: when I was writing a Commercial Invoice PDF generator, I needed to join:
- contact_name (stupid dba even separated out first,middle,last names...)
There was no design/overview doc for the database, so I had to figure all of that out by experimentation. It was ridiculous.
However, it did keep everything nice and separated!
Also, my invoice generator was extremely fast. A four-page invoice took just over one second from request to delivered. and the PDF it builds is really sexy, too (:
voiid4575283d@Ashkin "invoice generator was very fast."
I believe that to be true.. I did some reading and realised that most SQL are backed by optimisers that take care of most these things. So if you're join 10 tables and returning one row it doesn't really make a difference.
Databases are interesting and overwhelming to me. I have plans of going through the mySQL source code and probably making some experiments for myself. Will be worth it. Anyway thanks ...
solocoder307283dMaterialized views FTW
harrizsb824283dMuch join inside of subquery
Your Job Suck?
Take a quick quiz from Triplebyte to skip the job search hassles and jump to final interviews at hot tech firms
Get a Better Job