× 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.



Doesn't the "where rrn(a") preclude the use of an index, always causing a
table scan?

Using RRN(x) in the where condition will cause either a table scan or a
table probe (if there are no other where conditions).
In this way updating multiple records within a table based on the relative
record no will cause the table to be (completely) read multiple times.

Or did something change on a recent release?
No, even with the enhancements in release 6.1 which allows you to create
derived or sparse indexes, it is not possible to build an index over a
relative record no.

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"


-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von
Lennon_s_j@xxxxxxxxxxx
Gesendet: Wednesday, 23. June 2010 03:04
An: midrange-l@xxxxxxxxxxxx
Betreff: Re: Creating SQL Index

Ummm.
Or did something change on a recent release?

Sam

On 6/22/2010 4:19 PM, Kurt Anderson wrote:
I have a procedure in a service program that I'd like to change to use
SQL, but I can't seem to get my finger on how the index should look so the
optimizer picks it up. Here is the SQL in the procedure. The select is
actually a part of a declare. I'm fetching 250 rows at a time, and updating
every row.

Select Cust#, CalDte, Pac#, Dept#, CalTyp, DstFlg, BAmt,
DspQty,
Loc#, PrtFlg, SvPrtFlg, RRN(a)
From CdrMstP a
Where Cust# = :Cust# and CalDte<= :CutOff
and StmDte = '0001-01-01'
Order By Cust#, CalDte;

Update CdrMstP a
Set StmDte = :StmtDate,
Corp# = :Corp#,
Loc# = :ds_CdrOut.Loc#,
Dept# = :ds_CdrOut.Dept#,
PrtFlg = :ds_CdrOut.PrtFlg,
SvPrtFlg = :ds_CdrOut.SvPrtFlg
where rrn(a) = :ds_CDROut.CdrRRN;

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.