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数组,需要查询数组中包含特定字符串的记录时传统的LIKE语句无法直接使用,下面小编就为大家介绍两种... 目录问题背景解决方案对比1. 精确匹配方案(推荐)2. 模糊匹配方案参数化查询示例使用场景建议性能优

mysql表操作与查询功能详解

《mysql表操作与查询功能详解》本文系统讲解MySQL表操作与查询,涵盖创建、修改、复制表语法,基本查询结构及WHERE、GROUPBY等子句,本文结合实例代码给大家介绍的非常详细,感兴趣的朋友跟随... 目录01.表的操作1.1表操作概览1.2创建表1.3修改表1.4复制表02.基本查询操作2.1 SE

MySQL中的锁机制详解之全局锁,表级锁,行级锁

《MySQL中的锁机制详解之全局锁,表级锁,行级锁》MySQL锁机制通过全局、表级、行级锁控制并发,保障数据一致性与隔离性,全局锁适用于全库备份,表级锁适合读多写少场景,行级锁(InnoDB)实现高并... 目录一、锁机制基础:从并发问题到锁分类1.1 并发访问的三大问题1.2 锁的核心作用1.3 锁粒度分

MySQL数据库中ENUM的用法是什么详解

《MySQL数据库中ENUM的用法是什么详解》ENUM是一个字符串对象,用于指定一组预定义的值,并可在创建表时使用,下面:本文主要介绍MySQL数据库中ENUM的用法是什么的相关资料,文中通过代码... 目录mysql 中 ENUM 的用法一、ENUM 的定义与语法二、ENUM 的特点三、ENUM 的用法1

MySQL count()聚合函数详解

《MySQLcount()聚合函数详解》MySQL中的COUNT()函数,它是SQL中最常用的聚合函数之一,用于计算表中符合特定条件的行数,本文给大家介绍MySQLcount()聚合函数,感兴趣的朋... 目录核心功能语法形式重要特性与行为如何选择使用哪种形式?总结深入剖析一下 mysql 中的 COUNT

mysql中的服务器架构详解

《mysql中的服务器架构详解》:本文主要介绍mysql中的服务器架构,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1、背景2、mysql服务器架构解释3、总结1、背景简单理解一下mysqphpl的服务器架构。2、mysjsql服务器架构解释mysql的架

MySQL之InnoDB存储引擎中的索引用法及说明

《MySQL之InnoDB存储引擎中的索引用法及说明》:本文主要介绍MySQL之InnoDB存储引擎中的索引用法及说明,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐... 目录1、背景2、准备3、正篇【1】存储用户记录的数据页【2】存储目录项记录的数据页【3】聚簇索引【4】二

mysql中的数据目录用法及说明

《mysql中的数据目录用法及说明》:本文主要介绍mysql中的数据目录用法及说明,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1、背景2、版本3、数据目录4、总结1、背景安装mysql之后,在安装目录下会有一个data目录,我们创建的数据库、创建的表、插入的

MySQL中的InnoDB单表访问过程

《MySQL中的InnoDB单表访问过程》:本文主要介绍MySQL中的InnoDB单表访问过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1、背景2、环境3、访问类型【1】const【2】ref【3】ref_or_null【4】range【5】index【6】

MySQL 中 ROW_NUMBER() 函数最佳实践

《MySQL中ROW_NUMBER()函数最佳实践》MySQL中ROW_NUMBER()函数,作为窗口函数为每行分配唯一连续序号,区别于RANK()和DENSE_RANK(),特别适合分页、去重... 目录mysql 中 ROW_NUMBER() 函数详解一、基础语法二、核心特点三、典型应用场景1. 数据分