11
Awlex
3y

Today I wrote a SQL query with 7 joins. What's your record?

Comments
  • 2
    What do you do with 7 joins? View the whole database at once?
  • 6
    9 joins in a school project
    I challenged myself to implement most of the (basic) webapp project in that one query
    I succeeded but my grades did not lol
  • 2
    @theabbie Fetch all devices that should receive a push notification for a resource and perform additional permission checks
  • 0
    How was the performance?
  • 1
    12 -> to return a product and all its associated data.

    13, if you include the fact those 12 are in a sub select for filtering purposes.
  • 0
    11, mostly due to the fact that the db is about the organization of the company which is divided in a bunch loads of entities which all have their own tables.
  • 0
    My max is way higher (somewhere around 30 to 40). Needed to pivot the data for a report so lots of joins on itself. I've gone I got the max of mysql (61) but that was generated by third party code so does not count.
  • 0
    Also if you work with Drupal you get these things at ease (fieldable entities, each field is in its own table)
  • 1
    Around 15 for a query that actually runs in production. Initially it was 15, but i had to make some hierarhical structure for some users so add a few more to the mix.

    Yeah the "feature" was a piece of shit, but the project was quite clean and well tought out all in all.

    I still love the fact that that data could have been saved a lot more efficient and clean in a graph database..
Add Comment