db block gets (current gets) VS. consistent gets

2024-03-09 23:58

本文主要是介绍db block gets (current gets) VS. consistent gets,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

当前读(db block gets / current gets)与一致读(consistent gets)统称为逻辑读,逻辑读可能需要物理读把块读到cache中。

当前读指读现在已提交了的数据,一般在全表扫描读数据字典、更新、删除时发生。

一致读指读发出SELECT的那个时间点SCN的数据,一般在查询(增删改都可能有隐式查询)时发生。


db block gets are blocks read in 'current' mode.  meaning, get me the block as it exists right now, 
no read consistency.  do NOT undo changes.  Again, it is a mode, not an indication of how many 
blocks didn't need changes -- rather how many blocks we asked for in that MODE.
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:865586003021


In general, a statement will either get a block from the cache in current mode or consistent read mode. 
Those are logical IO's. The logical IO might need to do a physical IO in order to get the block into the cache - 
but the statement is doing either a consistent read or current mode read. 
http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:878847787577


You Askedhi tomi your discussion regarding consistant gets and db dblock gets
you mention about block read in CURRENT MODE AND consistent modeCould you please explain exact meaning of this words by giving 
some examples?Thanks and we said...Ok, when you turn on autotrace in sqlplus you can see these stats.  Lets run a query:ops$tkyte@ORA817.US.ORACLE.COM> set autotrace traceonly statistics
ops$tkyte@ORA817.US.ORACLE.COM> 
ops$tkyte@ORA817.US.ORACLE.COM> select * from emp;14 rows selected.Statistics
----------------------------------------------------------0  recursive calls4  db block gets2  consistent gets0  physical reads0  redo size1979  bytes sent via SQL*Net to client430  bytes received via SQL*Net from client2  SQL*Net roundtrips to/from client0  sorts (memory)0  sorts (disk)14  rows processedHere we had 4 db block gets.  Those were blocks read in CURRENT MODE.  The blocks that 
were read are actually the blocks that tell us how to FULL SCAN the dept table (data 
dictionary type of information).  We need to get that in CURRENT MODE (as of RIGHT NOW) 
to get an accurate picture of what the table looks like.  We also had 2 consistent gets -- these are blocks we read in "consistent read" mode -- 
also known as query mode.  This means we were reading them as of the POINT IN TIME the 
query began.  Seehttp://download-east.oracle.com/docs/cd/A81042_01/DOC/server.816/a76965/c23cnsis.htm#17882for a great discussion of this.Now, if we do a delete:ops$tkyte@ORA817.US.ORACLE.COM> delete from emp;14 rows deleted.Statistics
----------------------------------------------------------0  recursive calls20  db block gets1  consistent gets0  physical reads4220  redo size1009  bytes sent via SQL*Net to client796  bytes received via SQL*Net from client4  SQL*Net roundtrips to/from client1  sorts (memory)0  sorts (disk)14  rows processedwe do lots more db block gets -- why?  because in order to delete the data we need to get 
the block in CURRENT MODE, as it exists right then.why did we do a consistent get?  because the "read" part of the delete uses the 
consistent read mechanism -- we only delete data that existed in the table as of the 
point in time the delete began.  Consider if DEPT was a 1,000,000 row table instead.  
It'll take a while to delete all of those rows.  As you are deleting however, other 
sessions are inserting and committing data.  This consistent read mechanism makes it so 
that we only delete the rows that existed WHEN WE BEGAN the delete.  We will not delete 
this new data being inserted.
http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:878847787577


How Oracle Manages Data Concurrency and Consistency
http://docs.oracle.com/cd/B10501_01/server.920/a96524/c21cnsis.htm#2570

这篇关于db block gets (current gets) VS. consistent gets的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/792351

相关文章

MySQL 中的 JSON 查询案例详解

《MySQL中的JSON查询案例详解》:本文主要介绍MySQL的JSON查询的相关知识,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录mysql 的 jsON 路径格式基本结构路径组件详解特殊语法元素实际示例简单路径复杂路径简写操作符注意MySQL 的 J

Windows 上如果忘记了 MySQL 密码 重置密码的两种方法

《Windows上如果忘记了MySQL密码重置密码的两种方法》:本文主要介绍Windows上如果忘记了MySQL密码重置密码的两种方法,本文通过两种方法结合实例代码给大家介绍的非常详细,感... 目录方法 1:以跳过权限验证模式启动 mysql 并重置密码方法 2:使用 my.ini 文件的临时配置在 Wi

MySQL重复数据处理的七种高效方法

《MySQL重复数据处理的七种高效方法》你是不是也曾遇到过这样的烦恼:明明系统测试时一切正常,上线后却频频出现重复数据,大批量导数据时,总有那么几条不听话的记录导致整个事务莫名回滚,今天,我就跟大家分... 目录1. 重复数据插入问题分析1.1 问题本质1.2 常见场景图2. 基础解决方案:使用异常捕获3.

SQL中redo log 刷⼊磁盘的常见方法

《SQL中redolog刷⼊磁盘的常见方法》本文主要介绍了SQL中redolog刷⼊磁盘的常见方法,将redolog刷入磁盘的方法确保了数据的持久性和一致性,下面就来具体介绍一下,感兴趣的可以了解... 目录Redo Log 刷入磁盘的方法Redo Log 刷入磁盘的过程代码示例(伪代码)在数据库系统中,r

mysql中的group by高级用法

《mysql中的groupby高级用法》MySQL中的GROUPBY是数据聚合分析的核心功能,主要用于将结果集按指定列分组,并结合聚合函数进行统计计算,下面给大家介绍mysql中的groupby用法... 目录一、基本语法与核心功能二、基础用法示例1. 单列分组统计2. 多列组合分组3. 与WHERE结合使

Mysql用户授权(GRANT)语法及示例解读

《Mysql用户授权(GRANT)语法及示例解读》:本文主要介绍Mysql用户授权(GRANT)语法及示例,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录mysql用户授权(GRANT)语法授予用户权限语法GRANT语句中的<权限类型>的使用WITH GRANT

Mysql如何解决死锁问题

《Mysql如何解决死锁问题》:本文主要介绍Mysql如何解决死锁问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录【一】mysql中锁分类和加锁情况【1】按锁的粒度分类全局锁表级锁行级锁【2】按锁的模式分类【二】加锁方式的影响因素【三】Mysql的死锁情况【1

SQL BETWEEN 的常见用法小结

《SQLBETWEEN的常见用法小结》BETWEEN操作符是SQL中非常有用的工具,它允许你快速选取某个范围内的值,本文给大家介绍SQLBETWEEN的常见用法,感兴趣的朋友一起看看吧... 在SQL中,BETWEEN是一个操作符,用于选取介于两个值之间的数据。它包含这两个边界值。BETWEEN操作符常用

MySQL索引的优化之LIKE模糊查询功能实现

《MySQL索引的优化之LIKE模糊查询功能实现》:本文主要介绍MySQL索引的优化之LIKE模糊查询功能实现,本文通过示例代码给大家介绍的非常详细,感兴趣的朋友一起看看吧... 目录一、前缀匹配优化二、后缀匹配优化三、中间匹配优化四、覆盖索引优化五、减少查询范围六、避免通配符开头七、使用外部搜索引擎八、分

MySql match against工具详细用法

《MySqlmatchagainst工具详细用法》在MySQL中,MATCH……AGAINST是全文索引(Full-Textindex)的查询语法,它允许你对文本进行高效的全文搜素,支持自然语言搜... 目录一、全文索引的基本概念二、创建全文索引三、自然语言搜索四、布尔搜索五、相关性排序六、全文索引的限制七