Performance of dynamic SQL commands

A dynamic SQL implementation of an application generally performs worse than an implementation where permanent Adaptive Server stored procedures are created and the client program invokes them with RPC commands.

When you create Adaptive Server stored procedures for an application, SQL statement compilation and optimization are performed once when the procedure is created. On the other hand, a dynamic SQL application incurs compilation and optimization overhead every time the client program runs. A dynamic SQL implementation also incurs database space overhead because each instance of the client program must create separate compiled versions of the application’s prepared statements. In contrast, when you design an application to use stored procedures and RPC commands, all instances of the client program can share the same stored procedures.