This message was deleted.
# general
s
This message was deleted.
j
Hello Adam! Thanks for sharing the article. I'd like to point out that one of the provided examples as inefficient query is making the wrong assumptions... The
SELECT * FROM users AS user ... WHERE user.id='123'
with a bunch of LEFT JOINS will definitely be optimized by any modern database to only do the joins after applying the index on
id
on the
users
table. But if you change the
WHERE
condition to anything that is not an identifier/indexed attribute, the problem will exist for non-unique values.
a
It's not about optimizing the query. It's about how many rows you extract from the database. Due to left joins, you exponentially increase the number of rows.
This example is from one of my production systems. I'd love the database to optimize that, however, it wasn't so easy and the query was running for nearly half a minute.