Subject Execute | performance -vs- client side query
Author Mitchell Peek
I have a procedure that does an operation on a single table. However,
which operation it does may very well depend on the value of a timestamp
in one of several tables.

My options are, to build an SQL statement inside the procedure and
execute it with "execute", or, handle this from the client application
by running the query before calling the procedure.

This occurs in a batch type operation, and the procedure could be called
3 or 4 thoudand times in a row. Of course, a query will have to be run
for each iteration.

My question is whether that is best handled in the proc as described
above, or from the client.

More info: The proc running the query and the update, OR the client
running the query then calling the proc to do just the update will be
running from an Appserver on a middle tier with optimal (likely same
machine as the DB) network bandwidth, so, returning the data to te
client should be of minimal concern if the client runs the query outside
the proc.

Any input is appreciated.