3 ms·
I've also seen: SELECT * FROM DATA WHERE x > 12 where there's no corresponding index. There's also the infamous N+1 query pattern: // get list of ids
by candu 8y ago
I've also seen:
SELECT * FROM DATA WHERE x > 12
where there's no corresponding index. There's also the infamous N+1 query pattern:
// get list of ids
for each id in ids
r = SELECT * FROM DATA WHERE id=:id
if r.x > 12
do_something(r.y)
IMHO, both are signs of not fully understanding what the database does for you. In the same vein as the "learn JS before frameworks" argument, I'd argue devs should at least learn and understand SQL, indices, etc. before using ORMs.
- matwood 8y ago> I'd argue devs should at least learn and understand SQL, indices, etc. This was all dev 101 when I was coming up (yikes, almost 20 years ago now).
- candu 8y agoYeah, I wish it were common knowledge...although, if you ask 10 different devs, you'll get 10 different answers on what "ought" to be included in a basic CS / developer education. (You don't know the minutiae of pointer arithmetic!? You're not familiar with Docker, Vagrant, or AWS Lambda!? You can't construct a sed / awk one-liner with your eyes taped shut!? You don't know about concurrent skip lists!? You've never completed SICP or read Purely Functional Data Structures!? And so on.)