What is the difference between physical and logical reads in DB2/400?

10 pts.
Tags:
DB2/400
Physical File
When we do DSPFD for a file it shows physical and logical reads. What is the difference between physical and logical reads?

Answer Wiki

Thanks. We'll let you know when a new response is added.

The Physical File contains the data.
It can have a key but it does not have to.
If read without the key it reads in FIFO sequence. You can set a blocking factor and this is the faster way to process the file.

A logical file contains no data. It just has a access path to read the data from the PF.
A LF can cah a key and/or had Select/omit criteria.
In a high level program you must specify that it is a key file or it will read it in FIFO seq.

When using SQL or QRY, and you select an order, those products will look to see if a LF that already exists can bu used to read the file. If not, it creates one on the fly.
————————
This sure sounds like a homework question…
we don’t want to ruin your educational experience by doing your homework.
Phil

=====================================================

A “physical” read actually transferred data data from external storage into an I/O buffer. A “logical” read accessed a record that was already in an I/O buffer. Data is generally transferred between external storage and memory (buffers) in “blocks”. If you compare the size of a block to the size of a record, you might find that, e.g., ten records can fit into a single block. Thus, a “physical” read can transfer ten records. Ten “logical” reads could be done before another physical read was needed.

Note that this is primarily effective for sequentially reading files. If random reads always require fetching different blocks, then physical reads will be perhaps as many as logical reads.

Tom

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following