As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I applied a little more pressure than usual to my brain this morning and discovered something that is now obvious but eluded me for a long time.
Consider this code, which I have used many times:
TABLE FILE BASEL_TIME_D
SUM MIN.TIME_DIM_KEY
BY HIGHEST 1 TIME_DIM_KEY
END
The SQL trace:
AGGREGATION DONE ...
SELECT T1.TIME_DIM_KEY, MIN(T1.TIME_DIM_KEY) FROM
BASEL.TIME_D T1 GROUP BY T1.TIME_DIM_KEY ORDER BY
T1.TIME_DIM_KEY DESC FOR FETCH ONLY;
The WebFOCUS retrieval result:
NUMBER OF RECORDS IN TABLE= 39047 LINES= 39047
(BEFORE TOTAL TESTS)
39047 rows are retrieved by the DBMS and WebFCOUS outputs 1 row because of the BY HIGHEST 1 statement.
Now consider this code:
TABLE FILE BASEL_TIME_D
SUM MIN.TIME_DIM_KEY
BY HIGHEST TIME_DIM_KEY
WHERE READLIMIT EQ 1
END
The SQL trace:
AGGREGATION DONE ...
SELECT T1.TIME_DIM_KEY, MIN(T1.TIME_DIM_KEY) FROM
BASEL.TIME_D T1 GROUP BY T1.TIME_DIM_KEY ORDER BY
T1.TIME_DIM_KEY DESC FETCH FIRST 1 ROW ONLY FOR FETCH ONLY;
The WebFOCUS retrieval result:
NUMBER OF RECORDS IN TABLE= 1 LINES= 1
1 row is retrieved by the DBMS and WebFCOUS outputs 1 row.
This behaviour seems so obvious now that I've compared the two techniques, I just had never considered using WHERE READLIMIT EQ 1 in a real request, I've used it for testing purposes only.
I will have to review all my programs to make them more efficient.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
This would be OK when it's based on the fact that the record you want is, in fact, the first record that you read, right? So, the "MIN." is irrelevant with the use of "WHERE READLIMT EQ 1", right?
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005
Doug, it will definitely be the first record that I want, that's why the HIGHEST is there. The interesting thing about WHERE READMLIMIT EQ 1 is that, for DBMS tables, it doesn't actually behave the way one would think it does. The DBMS will read all the data, but output only 1 row.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
I've had my morning coffee and my afternoon tea and I'm still 'just not getting it'. It seems like you want to get the highest TIME_DIM_KEY in your table? Why not just do
Yes, your code makes sense when you need to retrieve one row. If you need to retrieve the 5 highest rows, then might the technique I describe make more sense?
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server