Dynamic SQL for enhanced Replication Server performance

Dynamic SQL in Replication Server enhances replication performance by allowing Replication Server Data Server Interface (DSI) to prepare dynamic SQL statements at the target user database and to execute them repeatedly. Instead of sending SQL language commands to the target database, only the literals are sent on each execution, thereby eliminating the overheads brought by SQL statement syntax checks and optimized query plan builds.

If turned on, dynamic SQL will be used in a user database connection instead of a language command if:

Setting up the configuration parameters to use dynamic SQL

Dynamic SQL is off by default at a server and connection level. Configure dynamic SQL at a server or a connection level by issuing these commands:

configure replication server 
set { dynamic_sql |
      dynamic_sql_cache_size |
      dynamic_sql_cache_management }
to value

alter connection to server.db
set { dynamic_sql |
      dynamic_sql_cache_size |
      dynamic_sql_cache_management }
to value

Table-level dynamic SQL control

create/alter replication definition commands allow you to control the application of dynamic SQL on each table through replication definition.

See the Replication Server Reference Manual for information about create/alter replication definition commands.

You can change the dynamic SQL execution at the table level for a specific replicate database by using:

set dynamic_sql {on | off}
for replication definition with replicate at
data_server.database

At the replication definition level, the default is to use dynamic SQL. You only need to use these commands to change the dynamic SQL usage if you want to exclude tables from dynamic SQL. To check for dynamic SQL usage, turn on stats_sampling and run admin stats, dsi command and look for DSIEDsqlPrepared, DSIEDsqlExecuted and other dynamic SQL related counters.

Use stored procedures rs_helprep, rs_helpsub, and rs_helppubsub to display dynamic SQL setting for each replication definition.

See “rs_helprep”, “rs_helpsub”, and “rs_helppubsub,” in Chapter 6, “Adaptive Server Stored Procedures” in the Replication Server Reference Manual for information about using these stored procedures.

The server-level configurations provide the default values for the connections created or started in the future. For database-level configurations:

Limitations

Dynamic SQL has these limitations: