views:

41

answers:

2

Most(if not all) of the MVC frameworks provide an abstraction layer over the database and except in some very special cases you do not need to write SQL code by hand. Of course you need to know basic things to design your model but do we need deep knowledge how to optimize queries, make triggers and other db stuff.

+3  A: 

Not unless your the one writing the the code for the data abstraction layer.

That's the whole point of it. Any layer above it doesn't need to know what the database type or structure is, or even if there is one.

It is a common mistake to start dragging database specific stuff back across the data layer into the business logic.

The acid test is that if you changed your database say from SQL to Oracle or MySQL would the rest of the code still work. If not then your data layer isn't doing its stuff correctly.

ChrisBD
+4  A: 

Have a read of Joel Spolsky's The Law of Leaky Abstractions. In an ideal world the data abstraction layer hides you from the complexity but unless you understand the complexity then the day it leaks you will get completely stuck in tar.

Dave Barker
+1. ORMs can lead to terrible performance if you don't know how they work. And they generally don't optimize queries (if you mean indexing) for you...
Shlomo
But not using the will increase the time for development and support. So maybe it is better to trust the framework and when I face some load problems to search for optimization of the specific bottleneck.
Ilian Iliev