[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: Newbie questions about dynamic query preparation in ABL

  • Thread starter Thread starter dbeavon
  • Start date Start date
Status
Not open for further replies.
D

dbeavon

Guest
>> It seems unnatural to repeatedly compile a piece of code that isn't really changing. > If it isn't changing then you may not need a dynamic query. I should have said it isn't really changing "within the inner loop". The customer number is changing in a loop, but the syntax of the query is not. I will concede that my example was overly trivial and doesn't prepare the original query in very a dynamic way. But lets just assume I need a dynamic query, despite the trivial example. Eg. lets say I need a dynamic query to be prepared, then I want to run it about 200 times. I want to run it based on a list of primary keys. I would like to be able to prepare the dynamic query and take a performance hit on QUERY-PREPARE a *single* time rather than 200 times. The other iterations are a variation on the query, but only insofar as they need to use a different value for iCustNum. > Short answer is you can't. That is what I feared. This is one place where the the "dynamic compile of source" approach may still be preferred, since the predicates in a dynamically compiled FOR-EACH can easily interact with all variables or parameters that are in scope. The QUERY-PREPARE approach is prone to having a ton of repetitive, compilation-related overhead, and that can be especially costly depending on the outer looping. Remote compilation is a bigger penalty for customers that are migrating to client-server-PASOE. Running QUERY-PREPARE a hundred times is costly.

Continue reading...
 
Status
Not open for further replies.
Back
Top