Quantcast
Channel: Comments and answers for "Set-Based vs. Procedural"
Viewing all articles
Browse latest Browse all 42

Answer by danlatimer

$
0
0
This isn't a complicated question and does not require a complicated answer: **Short Answer:** Databases are most efficient when you tell them what you want and let them figure out the most efficient way of doing it. **Longer answer:** Database engines have been designed to perform certain operations very efficiently. That's why traditional non procedural SQL doesn't tell the database what to do, just what it wants done. The database then has the freedom to do it in the most efficient mannor. **Example:** When you tell the database you want to iterate through a set of rows so you can count them you are telling the database how to do it. In this example it is easy to see that iterating isn't the most efficient way to determine the number of rows because the database stores these rows in special data structures that can perform operations like getting the total number VERY quickly maybe in one operation instead of N operations where N is the number of rows.

Viewing all articles
Browse latest Browse all 42

Latest Images

Trending Articles





Latest Images