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虚拟列的使用场景

《Mysql虚拟列的使用场景》MySQL虚拟列是一种在查询时动态生成的特殊列,它不占用存储空间,可以提高查询效率和数据处理便利性,本文给大家介绍Mysql虚拟列的相关知识,感兴趣的朋友一起看看吧... 目录1. 介绍mysql虚拟列1.1 定义和作用1.2 虚拟列与普通列的区别2. MySQL虚拟列的类型2

mysql数据库分区的使用

《mysql数据库分区的使用》MySQL分区技术通过将大表分割成多个较小片段,提高查询性能、管理效率和数据存储效率,本文就来介绍一下mysql数据库分区的使用,感兴趣的可以了解一下... 目录【一】分区的基本概念【1】物理存储与逻辑分割【2】查询性能提升【3】数据管理与维护【4】扩展性与并行处理【二】分区的

MySQL中时区参数time_zone解读

《MySQL中时区参数time_zone解读》MySQL时区参数time_zone用于控制系统函数和字段的DEFAULTCURRENT_TIMESTAMP属性,修改时区可能会影响timestamp类型... 目录前言1.时区参数影响2.如何设置3.字段类型选择总结前言mysql 时区参数 time_zon

Python MySQL如何通过Binlog获取变更记录恢复数据

《PythonMySQL如何通过Binlog获取变更记录恢复数据》本文介绍了如何使用Python和pymysqlreplication库通过MySQL的二进制日志(Binlog)获取数据库的变更记录... 目录python mysql通过Binlog获取变更记录恢复数据1.安装pymysqlreplicat

使用SQL语言查询多个Excel表格的操作方法

《使用SQL语言查询多个Excel表格的操作方法》本文介绍了如何使用SQL语言查询多个Excel表格,通过将所有Excel表格放入一个.xlsx文件中,并使用pandas和pandasql库进行读取和... 目录如何用SQL语言查询多个Excel表格如何使用sql查询excel内容1. 简介2. 实现思路3

Mysql DATETIME 毫秒坑的解决

《MysqlDATETIME毫秒坑的解决》本文主要介绍了MysqlDATETIME毫秒坑的解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着... 今天写代码突发一个诡异的 bug,代码逻辑大概如下。1. 新增退款单记录boolean save = s

mysql-8.0.30压缩包版安装和配置MySQL环境过程

《mysql-8.0.30压缩包版安装和配置MySQL环境过程》该文章介绍了如何在Windows系统中下载、安装和配置MySQL数据库,包括下载地址、解压文件、创建和配置my.ini文件、设置环境变量... 目录压缩包安装配置下载配置环境变量下载和初始化总结压缩包安装配置下载下载地址:https://d

MySQL中的锁和MVCC机制解读

《MySQL中的锁和MVCC机制解读》MySQL事务、锁和MVCC机制是确保数据库操作原子性、一致性和隔离性的关键,事务必须遵循ACID原则,锁的类型包括表级锁、行级锁和意向锁,MVCC通过非锁定读和... 目录mysql的锁和MVCC机制事务的概念与ACID特性锁的类型及其工作机制锁的粒度与性能影响多版本

MYSQL行列转置方式

《MYSQL行列转置方式》本文介绍了如何使用MySQL和Navicat进行列转行操作,首先,创建了一个名为`grade`的表,并插入多条数据,然后,通过修改查询SQL语句,使用`CASE`和`IF`函... 目录mysql行列转置开始列转行之前的准备下面开始步入正题总结MYSQL行列转置环境准备:mysq

MySQL不使用子查询的原因及优化案例

《MySQL不使用子查询的原因及优化案例》对于mysql,不推荐使用子查询,效率太差,执行子查询时,MYSQL需要创建临时表,查询完毕后再删除这些临时表,所以,子查询的速度会受到一定的影响,本文给大家... 目录不推荐使用子查询和JOIN的原因解决方案优化案例案例1:查询所有有库存的商品信息案例2:使用EX