Monday, December 8, 2008

Difference between Statement and Prepared Statement?

DBMS processes a query in following steps :
1. Parse the SQL query
2. Compile the SQL query
3. Plan(or optimize) the data acquisition path
4. Execute the optimized query / acquire and return data
Simple Statement: Executes all (1 to 4) for every query
PreparedStatement: pre-executes steps 1 to 3

No comments: