티스토리 뷰

ETC

(ETC) ODBC SQLDirectExecute 그리고 SQLExecute/Prepare 차이

주인장 진빼이

Using SQLPrepare/SQLExecute is not always as efficient as SQLExecDirect.

Use SQLExecDirect for queries that will be executed once and SQLPrepare/SQLExecute for queries that will be executed multiple times.

 

ODBC drivers are optimized based on the perceived use of the functions that are being executed. SQLPrepare/SQLExecute is optimized for multiple executions of statements that use parameter markers. SQLExecDirect is optimized for a single execution of a SQL statement. Unfortunately, more than 75% of all ODBC applications use SQLPrepare/SQLExecute exclusively.

 

Consider the case where an ODBC driver implements SQLPrepare by creating a stored procedure on the server that contains the prepared statement. Creating stored procedures involve substantial overhead, but the statement can be executed multiple times. Although creating stored procedures is performance-expensive, execution is minimal because the query is parsed and optimization paths are stored at create procedure time.

 

Using SQLPrepare/SQLExecute for a statement that is executed only once results in unnecessary overhead. Furthermore, applications that use SQLPrepare/SQLExecute for large single execution query batches exhibit poor performance. Similarly, applications that always use SQLExecDirect do not perform as well as those that use a logical combination of SQLPrepare/SQLExecute and SQLExecDirect sequences.

 

출처: media.datadirect.com/download/docs/odbc/allodbc/index.html#page/odbc/using-sqlprepare-2fsqlexecute-and-sqlexecdirect.html

 

SQLDirectExecute SQLExecute/Prepare
단일 명령 처리 적합 다중 및 일괄 명령 처리 적합
Parameter 바인딩
- 오버헤드 발생(Stored Procedure)
댓글
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함