There are certain classes of operations where native I/O (SETLL,
CHAIN,
etc.) is faster, often much faster, than SQL.
We've beaten this to death, and I won't disagree, with (of course) one
caveat. Yes, single-row IO is faster in native, but w/SQL you may have
many fewer IOs. Take, for example, loading an order-detail subfile. Say
you show line#, item#, ordered-quantity, item-description and price.
In HLL-mode you'd setll to the order-detail file, and read each row.
Then, for each detail line, you'd chain to the item file to get the
description and then setgt/readpe to the item-price table to get the
price effective on the order date, and repeat for each of the detail
lines. So you have the IOs for the detail lines, plus a single-row read
on item and a single-row read on item-price.
If you did the same process in SQL then the native IO would be clearly
faster. But, you shouldn't use the same process, you should rethink the
process and use a single statement to get it all:
Select OL.OrderLine, OL.Item#, I.Description,
(select top 1 IP.Price from ItemPrice IP
where IP.Item# = I.Item#
and IP.EffDate = O.OrderDate)
From OrderLine OL
Join Order O
on OL.Order# = O.Order#
Join Item I
on OL.Item# = I.Item#
Where OL.Order# = 12345
-Walden
As an Amazon Associate we earn from qualifying purchases.