FATAL ERROR! Unrecognized type for serendipity_event_freetag:: !
2009/12 1
1. Cache
Direct execution can use MySQL cache when two sqls are the absolutely same .
Prepared execution can't use MySQL cache, even if no placeholders were employed.

2. Speed
Direct execution query need to be parsed every time.
Prepared execution query is parsed only once.
Prepared statements might not provide a performance increase in some situations. For best results, test your application both with prepared and nonprepared statements and choose whichever yields best performance.


3. Network
Direct execution sends all the query to MySQL services.
Prepared execution sends twice, The first is for prepared query, then the arguments.
If you call a prepared more than once, prepared execution can reduce the network traffic.

4. Safe
Direct execution might cause a sql inject if the programmer doesn't handle the unsafe input rightly and carefully.
Prepared execution is safe because the query and the arguments are split.


Ref:
1. http://dev.mysql.com/doc/refman/5.0/en/c-api-prepared-statements.html
2. http://dev.mysql.com/doc/refman/5.0/en/query-cache-operation.html

Defined tags for this entry:

Posted by rollenc

Last modified on 2009-12-01 13:50