× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



A STRDBG over the relevant database server job (QZDASOINIT) should give
similar information I believe.
http://as400blog.blogspot.com/

2009/5/5 <lloen@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>

Here is the statement:


SELECT FLD2, FLD3, MIN(MINFLD) AS MINFLD, FROM LIB.FILENAME where ....
GROUP BY MINFLD, FLD2, FLD3, ... fetch first 100 rows only (statement has
been altered to change the field names and for brevity).

The GROUP BY does not seem to work on the 6.1 server. We want the records
returned in ascending order by MINFLD.


As noted by others, an ORDER BY is required to get an ordered sequence.

This would be more obvious on other SQL products. There is a slight
bias on "i" for returning things in the original (arrival sequence)
order, but it is _never guaranteed_ without the use of ORDER BY.

Absent that, there would be a bias on any DB product towards using
whatever index was used to fetch things back.

For instance, perhaps there is an existing index over MINFLD or one is
created as part of the execution of the SQL statement. That's probably
what is usually happening here and why the ordering is "mostly" by
MINFLD.

One would have to do a Visual Explain over the statements from the
various environments to see why there would be differences. But,
differences are possible, because the SQL optimizer may change the
access plan for all kinds of reasons. Since SQL formally allows the
records to come back in any order if there is no ORDER BY, a change of
plan can and will change the order of the records fetched.

Reasons for this include:

1. Changes in the size of the underlying file.
2. Slight changes in the SQL (did someone type fetch first 50 rows only
in some other test?).
3. Whether the QAQQINI file is present (which changes the 'hints' the
optimizer uses).
4. The exact environment used.

Number 4 is particularly relevant.

In this reference:
http://www.ibm.com/developerworks/data/library/techarticle/dm-0611milligan/

. . it shows the goal of *ALLIO versus *FIRSTIO (which I personally know
can greatly influence how records are fetched) varies by comparatively
triffling differences in the environment.

Note that it is even different for native JDBC versus toolbox JDBC, for
instance.



Larry Loen
www.applicationperformancegroup.com




--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.