Should I always prefer to work with prepared SQL statements to improve performance?

I understand that the prepared statement is compiled on the server once, thus saving the overhead of repeating parsing, optimization, etc. Apparently, I should always use ready-made instructions for queries that run more than once.

Are there any flaws in this approach?

I am using odbc (libodbC ++) from C ++ to mysql.

+3
source share
4 answers

Prepared reports :

Why use prepared instructions?

, , .

, SQL . , SQL- . , ad hoc, . , , , . , . MySQL , escaped .

. . , MySQL . , , . , , , INSERT.

(: MySQL 4.1, , , .)

, , . MySQL . , , , ( ) , , , string . . , .

? , ( ) . -, , DML (INSERT, REPLACE, UPDATE DELETE), CREATE TABLE SELECT. , API .

→ , . , , , . , , .

+5

. , (, sqlite IPhone).

+2

. SQL-, , SQL.

, , ( ), . : . ad-hoc , , ", ".

, , , ad-hoc . , .

+2
source

Source: https://habr.com/ru/post/1783835/


All Articles