Stored procedures: which of the following is NOT an advantage of using stored procedures in a database system?
-
AGreater security
-
BSQL can be optimized
-
CCode sharing
-
DIncreased network traffic
Answer
Correct Answer: Increased network traffic
Explanation
Introduction / Context:Stored procedures encapsulate SQL and logic on the server. They are used for performance, security, and maintainability. This question asks you to identify which option is not a benefit.
Given Data / Assumptions:
- Stored procedures execute on the database server.
- Clients call procedures with parameters instead of sending large ad-hoc SQL blocks.
- DBMSes cache execution plans and enforce privileges at the procedure boundary.
Concept / Approach:Benefits include reduced round trips (less network traffic), consistent logic reuse (code sharing), improved security (expose only the proc), and plan reuse/optimization. Therefore, “increased network traffic” contradicts the usual effect.
Step-by-Step Solution:
List typical advantages: security, plan optimization, reuse, and less data over the wire.Evaluate each option versus this list.Identify the negative outlier: “Increased network traffic.”Verification / Alternative check:Compare two approaches: sending many individual SQL statements vs. one stored procedure call with parameters. The latter generally reduces bytes and latency.
Why Other Options Are Wrong:
- Greater security: procedures can limit direct table access.
- SQL can be optimized: plan caching and tuning are common.
- Code sharing: procedures centralize shared logic.
Common Pitfalls:Assuming stored procedures always improve performance. Poorly written procedures or excessive server logic can still perform badly; however, they do not inherently increase network traffic.
Final Answer:Increased network traffic