Focal Point
[SOLVED] FROM - TO vs. GE and LE

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/379100451

June 17, 2009, 02:04 PM
JohnB
[SOLVED] FROM - TO vs. GE and LE
Which is more efficient as far as processing required:

WHERE FIELD FROM value TO value

- OR -

WHERE FIELD GE value
WHERE FIELD LE value

Thank you,

John

This message has been edited. Last edited by: JohnB,


WF 7.7.03, Windows 7, HTML, Excel, PDF
June 17, 2009, 02:19 PM
Francis Mariani
If you're reading a DBMS table, then the SQL generated is exactly the same. For example, reading a DB2 table with the two different filters, FROM-TO GE-LE generates the same SQL:

SELECT T1."TIME_DIM_KEY" FROM BASEL.TIME_D T1 WHERE
 (T1."TIME_DIM_KEY" BETWEEN 37540 AND 37542) FOR FETCH ONLY;



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
June 17, 2009, 02:19 PM
Darin Lee
Efficiency is usually relative to the database. The best way to test what is most efficient is to generate an SQL trace to see the SQL that is generated by each and then use some DBMS tool (or your local DBA) to tell you which is more efficient for the DB you use. I would venture a guess that there would be no difference between the two for most DBs.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
June 17, 2009, 02:22 PM
Doug
I agree... I have not, yet, seen a difference in performance using either of the above mentioned methods. I, personally, prefer to code the "FROM this TO that". Just remember that it's inclusive (GE ... LE)
June 18, 2009, 06:43 AM
Tony A
One thing that I would caution you on when using either method against RDBMS fields that have a date-time format (HYYMDs etc.) where you have them respecified in the MAS as USAGE=YYMD, ACTUAL=DATE is that the SQL produced extends the variable of the form YYMD to HYYMDs and appends 00:00:00 as the time element. This causes any field value with a real time value to be omitted from the selection. For example -
In MAS -
FIELD Date_Time_Value, ALIAS=Date_Time_Value, USAGE=HYYMDs, ACTUAL=HYYMDs, $
FIELD Date_Value,      ALIAS=Date_Time_Value, USAGE=YYMD, ACTUAL=DATE, $
Rec Date_Time_Value
 1  2009/01/01 00:00:00
 2  2009/01/01 10:01:25
 3  2009/01/01 20:01:25
 4  2009/01/02 00:00:00
 5  2009/01/02 10:01:25
 6  2009/01/02 20:01:25

WHERE Date_Value FROM '2009/01/01' TO '2009/01/02'

will return records 1 thru 4 but will not return 5 or 6.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10