Is it just a question of performance because of the unnecessary fields?
Contrary to RPG with embedded SQL you can select what you really need.
Assumed you only need 3 columns (total 50 Byte while the row length is 5000
Byte). Why to load 4950 Byte you won't need for a single row?
The other advantage when selecting the data you need, is the query optimizer
may use an IOA (Index Only Access), that means an index or logical file can
found where all requested information is stored in the key fields, so no
further access to the data base record is needed. IOA is the fastest method
to access data. When using SELECT * an IOA will not be possible.
The other advantage when using field selection instead of SELECT *, you can
enhance your table without any need to recompile your programs. When using
SELECT * you may need an (external) data structure to hold the information
and this data structure layout will included at compile time into your
program object. To get the current data structure/file layout included, you
need to recompile your programs.
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 David FOXWELL
Gesendet: Wednesday, 24. March 2010 08:14
An: Midrange Systems Technical Discussion
Betreff: RE: when to use a function or file for information
-----Message d'origine-----
[mailto:midrange-l-bounces@xxxxxxxxxxxx] De la part de rob@xxxxxxxxx
vendor product. Correlarry: Never use "select * from...".
Always specify the columns desired.
Rob, I can't remember what was wrong with doing it like this :
D myDS E DS extname( myfile )
Select * into myDS from myfile
As I am seeing other programmers write. Is it just a question of performance
because of the unnecessary fields?
As an Amazon Associate we earn from qualifying purchases.