Consultor Eletrônico



Kbase P36102: Calculated fields => Use Joins instead when possible
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   08/08/2003
Status: Unverified

SYMPTOM(s):

SDO has a calculated field

Any problem

CAUSE:

SDO has a calculated field although a join could be used instead

FIX:

Many developers use a calculated field to retrieve data from another table.
Many time, such a calculated field could be avoided by relying on a Joined table instead. This also results in better performance.

Indeed, when relying on a calculated field, procedure DATA.CALCULATE is fired each time a record is added in RowObject temp-table (in adm2/query.p/transferDBRow).  This is just slower than a QUERY with joins, which is handled at the 4GL core level.

In other word, the query should look like:
FOR EACH TableA NO-LOCK, FIRST TableB [OUTER-JOIN] [OF TableA | WHERE expression] NO-LOCK