Oracle physical read and logical read

Source: Internet
Author: User
PhysicalReads: the logical read content is in the memory and does not need to be read from the hard disk. The formula is as follows: PhysicalReadsdbblockgets + consist

Physical Reads: The logical read content is in the memory and does not need to be read from the hard disk. The formula is as follows: Physical Reads = db block gets + consist

Physical Reads (Physical read ):

The logical read content is in the memory and does not need to be read from the hard disk.

The formula is as follows: Physical Reads = db block gets + consistent gets;


Logical Reads (Logical read ):

Physical reading means that the content is not in the memory and should be read into the memory on the hard disk.


Db block gets -- number of blocks read from the buffer cache.
Consistent gets -- number of undo data blocks read from the buffer cache.

Db block gets is the number of blocks read in current mode. In current mode, data is read to ensure that the data read is the latest data at the current time point. This is generally done for the needs of DML statements, such as updates, naturally, you need to know the latest data;

Consistent gets is the number of blocks read in consistent mode. The consistent mode is mainly used to ensure consistent reading of Oracle data. It generally occurs in the case of select. The read data may be an actual block, it may also need to be constructed based on the scn information, transaction information, and data in the rollback segment.


Summary:

In Oracle, the data is finally retrieved from the Buffer, so logicalreads will inevitably appear every time a physicalreads appears, but there is something worth attention here, that is, when there is a physicalreadsLogicalReadsHere, we actually only calculate 1 block!

Therefore, if you use this formula (Physical Reads = db block gets + consistent gets;) to calculate Physical Reads, the logical read contains Physical Reads.

Both db block gets and consistent gets may occur.Physicalreads andLogicalReadsIn either case, db block gets and consistent gets constitute the total number of times all blocks are read in a database operation.

Therefore, logicalreads can be calculated using the following formula:

Logicalreads = (db block gets + consistent gets)-physicalreads.

As a result, the formula for cache hit rate is obtained:
Hit Ratio = (db block gets + consistent gets-physicalreads)/(db block gets + consistent gets) * 100%;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.