I have a scenario where I need to filter against a hold file which can contain hundreds or even thousands of rows. The hold file was achieved in a somewhat complex manner, so a simple join wouldn't work for me.
I had a query against an Oracle table, filtered against a large hold file...
TABLE FILE XYZ
...
ON TABLE HOLD AS LARGEHOLD
END
TABLE FILE ORACLE_TABLE
SUM
FIELD
BY BYFIELD
IF FIELD2 EQ (LARGEHOLD)
ON TABLE HOLD AS RESULTS
END
I found that the performance was very slow...about 25 seconds to retrieve a few thousand records from a table with 1.75 million rows. It turns out that the resultant Oracle query gets bogged down with the {WHERE field IN list} clause (which is the result of the IF FIELD2 EQ (LARGEHOLD) statement). My list was about 135 entries.
So what I did was create a 2-step process. I moved the filter against LARGEHOLD to a second query, like this:
TABLE FILE ORACLE_TABLE
SUM
FIELD
BY BYFIELD
ON TABLE HOLD AS RESULTS
END
TABLE FILE RESULTS
SUM
FIELD
BY BYFIELD
IF FIELD2 EQ (LARGEHOLD)
ON TABLE HOLD AS FINAL
END
This had the effect of reducing response time to 1/5 of the original query. It went from 25 seconds to 5 seconds.
And as an added bonus, I don't hit the Oracle limit of 1000 expressions in a list (when my list happens to be larger than 1000 items), because the filter is now against the Focus file, which does not have this limitation.
Here is the error message I received when filtering directly against the Oracle table, with a list > 1000 items:
(FOC1400) SQLCODE IS 1795 (HEX: 00000703)
: ORA-01795: maximum number of expressions in a list is 1000
Hope this helps someone.
Sean
------------------------------------------------------------------------
PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode