|
message: 3
date: Wed, 30 Jul 2008 10:53:56 -0500
from: CRPence <>
subject: Re: SQL - RRN() not in order
The index may be used when either large number of
deleted rows exist
or when the amount of memory to page is easily managed by
index vs the
dataspace. That is because the index has the RRN [or RRN
can be easily
calculated from], and that index can be more efficiently
paged than the
entire dataspace with a full table scan. So when all of
the information
is available in an index which is smaller than the data, it
can be much
more efficient to use the index instead, especially when
there is no
selection.
Note: To further clarify on the Join Logical File
index... There is
not just one index for all three files. In the three file
join, the
database creates the primary index as declared in the DDS,
and then
creates additional indexes on the second and third file
which assist in
effecting matches for join and selection. Given no
selection, each
index created on each file is much like a CREATE INDEX
which is used for
implementation of a dynamic join when the JLF is opened;
just that there
is not a separate object, to which the index can be
associated.
Regards, Chuck
Luis Rodriguez wrote:
the only way to
I agree (and am very conscious of) with the fact that
guarantee a result ordered is with the ORDER BYclause.
using an index for
That said, what I don't really understand is SQL
reporting the RRN(). One would imagine that kind ofthings would be
better doing a table scan.included--that if
Terrence Enger wrote:
Let me remind people--I confess, myself
specify that orderyou want results in a specific order, you must
strange (at least for me)explicitly. <<SNIP>>
Luis Rodriguez wrote:
Running some tests (V5R3) I found this
with no index andresults with SQL RRN: (FILE is a (DDS) file
FILE;zero deleted records) Select RRN(file) from
ordered SELECT RRN(A),A.* >>
<<SNIP unordered SELECT RRN(A) vs
shows that SQL decided
Running the sentence under debug (STRDBG)
RRN() needs anto use an index (LF). My question is: Why does
file(3 Files!!)index?. Moreover, the selected index is a join
now, I'm just curiousThis is not giving any problem for me right
why this is so. Any ideas?
------------------------------
As an Amazon Associate we earn from qualifying purchases.
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.