A define is by definition done on row-level, BEFORE the actual query.
When you use it in a where is logical that the DBMS has to apply the define on row level before being able to check it against the WHERE.
And yes, a COMPUTE can accomplish the same a DEFINE.
But the COMPUTE is executed by the WF-engine. A Define is done by the DBMS-engine.
The last one being the quickest, usually.
But consider this:
I've a query to detect price-cuts.
define file x
pricecut/A1 = if standard_price gt customer_price then 'Y' else 'N';
end
table file x
sum units
by day
where pricecut eq 'y';
end
With a COMPUTE:
I have 2.000.000 rows in the dbms, I'll get 2.000.000 back from the DBMS for WF to apply the computes and filters.
With the define I get 1 line for each day.
I'd rather have the DBMS filter all none price-cut lines BEFORE sending them to the WF-engine.
It really depends on the amount of data retrieved, the complexity of the defines, speed of the DBMS and WF systems.
Hard to predict which is the fastest.
G'luck.
_____________________
WF: 8.0.0.9 > going 8.2.0.5