consistent gets,这个是从undo里读的数量,Oracle 为了保证数据的一致性,当一个查询很长,在查询之后,数据块被修改,还未提交
arraysize定义了一次返回到SQLPLUS客户端的行数,当扫描了arraysize 行后,停止扫描,返回数据,然后继续扫描。
这个过程就是统计信息中的SQL*Net roundtrips to/from client。
因为arraysize 默认是15行,那么就有一个问题,所以如果按照15行扫描一次,那么每次扫描要多扫描一个数据块,一个数据块也可能就会重复扫描多次。
重复的扫描会增加consistent gets 和 physical reads。 增加physical reads,这个很好理解,扫描的越多,物理读的可能性就越大。
consistent gets,这个是从undo里读的数量,Oracle 为了保证数据的一致性,当一个查询很长,在查询之后,数据块被修改,还未提交,再次查询时候,Oracle根据Undo 来构建CR块,这个CR块,可以理解成数据块在之前某个时间的状态。 这样通过查询出来的数据就是一致的。
那么如果重复扫描的块越多,需要构建的CR块就会越多,这样读Undo 的机会就会越多,consistent gets 就会越多。
如果数据每次传到客户端有中断,那么这些数据会重新扫描,这样也就增加逻辑读,所以调整arraysize可以减少传的次数,,减少逻辑读。
所以通过上面的说明,arraysize 参数如果过低,会影响如physical reads,consistent gets 还有SQL*Net roundtrips to/from client次数。 ---本段引自DAVE博客。
实验结论:实验用表是由dba_objects;创建。通过设置arraysize为1、15、200,可以通过最后的汇总表格得出将arraysize设置为200,可以得到更好的查询性能。
具体表现在:SQL语句执行时间大幅减少,通过Oracle Net从客户端收到的字节总数大幅减少,SQL * Net发送和从客户端接收的字节总数大幅减少--减幅比例接近arraysize尺寸的比例。
所以在使用SQLPLUS客户端查取大数据、SPOOL输出时,可以考虑将arraysize设置的大一点,提高性能。永久设置此参数可以在$ORACLE_HOME/sqlplus/admin/glogin.sql中写入set arraysize 15 这样。
1,使用SQLPLUS的ARRAYSIZE默认值15来进行测试BYS@bys1>create tabele test2 as select * from dba_objects;
BYS@bys1>alter system flush shared_pool;
System altered.
BYS@bys1>alter system flush buffer_cache;
System altered.
BYS@bys1>set arraysize 15 因为我已经更改过,所以手动再改为默认的15
此设置只在当前SESSION中有用,如果需要永久设置,可以在$ORACLE_HOME/sqlplus/admin/glogin.sql中写入set arraysize 15 这样。
BYS@bys1>set autotrace traceonly stat
BYS@bys1>select * from test2;
72465 rows selected.
Elapsed: 00:00:02.12
Statistics
----------------------------------------------------------
606 recursive calls
0 db block gets
5882 consistent gets
1052 physical reads
0 redo size
8036433 bytes sent via SQL*Net to client
53549 bytes received via SQL*Net from client
4832 SQL*Net roundtrips to/from client
6 sorts (memory)
0 sorts (disk)
72465 rows processed
汇总:执行时间:02.12秒,606次递归调用,5882 一致读,1052 物理读,8036433 bytes发送,53549 bytes接收,4832次往返
更多详情见请继续阅读下一页的精彩内容:
相关阅读:
rlwrap - 解决Linux下SQLPLUS退格、上翻键乱码问题
SQLPLUS spool 到动态日志文件名
Oracle SQLPLUS提示符设置
通过设置SQLPLUS ARRAYSIZE(行预取)加快SQL返回速度
Oracle arraysize 和 fetch size 参数与性能优化说明

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

MySQloffersechar, Varchar, text, Anddenumforstringdata.usecharforfixed-Lengthstrings, VarcharerForvariable-Length, text forlarger text, AndenumforenforcingdataAntegritywithaetofvalues.

Optimizing MySQLBLOB requests can be done through the following strategies: 1. Reduce the frequency of BLOB query, use independent requests or delay loading; 2. Select the appropriate BLOB type (such as TINYBLOB); 3. Separate the BLOB data into separate tables; 4. Compress the BLOB data at the application layer; 5. Index the BLOB metadata. These methods can effectively improve performance by combining monitoring, caching and data sharding in actual applications.

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
