Home Database Mysql Tutorial db_keep_cache_size参数的控制范围测试

db_keep_cache_size参数的控制范围测试

Jun 07, 2016 pm 03:58 PM
cache keep OC size parameter control test scope

ocm考试新题中,需要创建keep存储的表,但在该参数是否应该修改上,有一些分歧,有人说asmm会自动给keep分配内存的,该参数就不用设置了。 看文档和asktom,也是云山雾罩,说什么的都有,还是来实际的测试吧: SQL col COMPONENT for a30SQL select COMPONEN

ocm考试新题中,需要创建keep存储的表,但在该参数是否应该修改上,有一些分歧,有人说asmm会自动给keep分配内存的,该参数就不用设置了。

看文档和asktom,也是云山雾罩,说什么的都有,还是来实际的测试吧:

SQL> col COMPONENT for a30
SQL> select COMPONENT,CURRENT_SIZE/1024/1024||'MB' MB from V_$SGA_DYNAMIC_COMPONENTS where COMPONENT in ('DEFAULT buffer cache','KEEP buffer cache');

COMPONENT                      MB                                               
------------------------------ ------------------------------------------       
DEFAULT buffer cache           352MB                                            
KEEP buffer cache              0MB                                              

SQL> conn hr/hr
Connected.
SQL> drop table t1 purge;

Table dropped.

SQL> create table t1 as select * from employees;

Table created.

SQL> insert into t1 select * from t1;

107 rows created.

SQL> /

214 rows created.

SQL> /

428 rows created.

SQL> /

856 rows created.

SQL> /

1712 rows created.

SQL> /

3424 rows created.

SQL> /

6848 rows created.

SQL> /

13696 rows created.

SQL> commit;

Commit complete.

SQL> col SEGMENT_NAME for a10
SQL> select SEGMENT_NAME,BYTES/1024/1024||'mb' MB from user_segments where SEGMENT_NAME='T1';

SEGMENT_NA MB                                                                   
---------- ------------------------------------------                           
T1         3mb                                                                  

SQL> alter table t1 storage( buffer_pool keep);

Table altered.

--造了一张3m的keep表
SQL> set autot on
SQL> select count(*) from t1;

  COUNT(*)                                                                      
----------                                                                      
     27392                                                                      


Execution Plan
----------------------------------------------------------                      
Plan hash value: 3724264953                                                     
                                                                                
-------------------------------------------------------------------             
| Id  | Operation          | Name | Rows  | Cost (%CPU)| Time     |             
-------------------------------------------------------------------             
|   0 | SELECT STATEMENT   |      |     1 |    85   (0)| 00:00:02 |             
|   1 |  SORT AGGREGATE    |      |     1 |            |          |             
|   2 |   TABLE ACCESS FULL| T1   | 26589 |    85   (0)| 00:00:02 |             
-------------------------------------------------------------------             
                                                                                
Note                                                                            
-----                                                                           
   - dynamic sampling used for this statement                                   

--做全表扫描,没有物理读,说明是从之前的插入语句读取的数据,并做了240次递归
Statistics
----------------------------------------------------------                      
        240  recursive calls                                                    
          1  db block gets                                                      
        421  consistent gets                                                    
          0  physical reads                                                     
        176  redo size                                                          
        413  bytes sent via SQL*Net to client                                   
        385  bytes received via SQL*Net from client                             
          2  SQL*Net roundtrips to/from client                                  
          4  sorts (memory)                                                     
          0  sorts (disk)                                                       
          1  rows processed                                                     

SQL> select count(*) from t1;

  COUNT(*)                                                                      
----------                                                                      
     27392                                                                      


Execution Plan
----------------------------------------------------------                      
Plan hash value: 3724264953                                                     
                                                                                
-------------------------------------------------------------------             
| Id  | Operation          | Name | Rows  | Cost (%CPU)| Time     |             
-------------------------------------------------------------------             
|   0 | SELECT STATEMENT   |      |     1 |    85   (0)| 00:00:02 |             
|   1 |  SORT AGGREGATE    |      |     1 |            |          |             
|   2 |   TABLE ACCESS FULL| T1   | 26589 |    85   (0)| 00:00:02 |             
-------------------------------------------------------------------             
                                                                                
Note                                                                            
-----                                                                           
   - dynamic sampling used for this statement                                   

--第二次全表扫描已经没有递归了,说明数据已经存入内存,并整齐摆放了
Statistics
----------------------------------------------------------                      
          0  recursive calls                                                    
          0  db block gets                                                      
        310  consistent gets                                                    
          0  physical reads                                                     
          0  redo size                                                          
        413  bytes sent via SQL*Net to client                                   
        385  bytes received via SQL*Net from client                             
          2  SQL*Net roundtrips to/from client                                  
          0  sorts (memory)                                                     
          0  sorts (disk)                                                       
          1  rows processed                                                     

SQL> set autot off
SQL> conn / as sysdba
Connected.
SQL> select COMPONENT,CURRENT_SIZE/1024/1024||'MB' MB from V_$SGA_DYNAMIC_COMPONENTS
  2  where COMPONENT in ('DEFAULT buffer cache','KEEP buffer cache');

COMPONENT                      MB                                               
------------------------------ ------------------------------------------       
DEFAULT buffer cache           352MB                                            
KEEP buffer cache              0MB                                              
--查看内存,整齐摆放的数据并未在keep内存里,说明在default里
SQL> alter system set db_keep_cache_size=12m;

System altered.

SQL> select COMPONENT,CURRENT_SIZE/1024/1024||'MB' MB from V_$SGA_DYNAMIC_COMPONENTS
  2  where COMPONENT in ('DEFAULT buffer cache','KEEP buffer cache');

COMPONENT                      MB                                               
------------------------------ ------------------------------------------       
DEFAULT buffer cache           340MB                                            
KEEP buffer cache              12MB                                             
--开辟keep内存
SQL> conn hr/hr
Connected.
SQL> set autot on
SQL> select count(*) from t1;

  COUNT(*)                                                                      
----------                                                                      
     27392                                                                      


Execution Plan
----------------------------------------------------------                      
Plan hash value: 3724264953                                                     
                                                                                
-------------------------------------------------------------------             
| Id  | Operation          | Name | Rows  | Cost (%CPU)| Time     |             
-------------------------------------------------------------------             
|   0 | SELECT STATEMENT   |      |     1 |    85   (0)| 00:00:02 |             
|   1 |  SORT AGGREGATE    |      |     1 |            |          |             
|   2 |   TABLE ACCESS FULL| T1   | 26589 |    85   (0)| 00:00:02 |             
-------------------------------------------------------------------             
                                                                                
Note                                                                            
-----                                                                           
   - dynamic sampling used for this statement                                   

--重新做全表扫描,优化器虽然已经发现内存default里有数据,但是keep内存开辟了,表又是keep的,但keep里没找到数据
--所以在此强制做了物理读
--说明keep参数为0的时候,表虽然是keep的,但数据还是在default里的,keep的大小并未被asmm自动分配
Statistics
----------------------------------------------------------                      
          0  recursive calls                                                    
          0  db block gets                                                      
        310  consistent gets                                                    
        307  physical reads                                                     
          0  redo size                                                          
        413  bytes sent via SQL*Net to client                                   
        385  bytes received via SQL*Net from client                             
          2  SQL*Net roundtrips to/from client                                  
          0  sorts (memory)                                                     
          0  sorts (disk)                                                       
          1  rows processed                                                     

SQL> select count(*) from t1;

  COUNT(*)                                                                      
----------                                                                      
     27392                                                                      


Execution Plan
----------------------------------------------------------                      
Plan hash value: 3724264953                                                     
                                                                                
-------------------------------------------------------------------             
| Id  | Operation          | Name | Rows  | Cost (%CPU)| Time     |             
-------------------------------------------------------------------             
|   0 | SELECT STATEMENT   |      |     1 |    85   (0)| 00:00:02 |             
|   1 |  SORT AGGREGATE    |      |     1 |            |          |             
|   2 |   TABLE ACCESS FULL| T1   | 26589 |    85   (0)| 00:00:02 |             
-------------------------------------------------------------------             
                                                                                
Note                                                                            
-----                                                                           
   - dynamic sampling used for this statement                                   


Statistics
----------------------------------------------------------                      
          0  recursive calls                                                    
          0  db block gets                                                      
        310  consistent gets                                                    
          0  physical reads                                                     
          0  redo size                                                          
        413  bytes sent via SQL*Net to client                                   
        385  bytes received via SQL*Net from client                             
          2  SQL*Net roundtrips to/from client                                  
          0  sorts (memory)                                                     
          0  sorts (disk)                                                       
          1  rows processed                                                     

SQL> spool off
Copy after login
如果考keep,该参数,还是打开了吧,recycle同理
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What do you think of furmark? - How is furmark considered qualified? What do you think of furmark? - How is furmark considered qualified? Mar 19, 2024 am 09:25 AM

What do you think of furmark? 1. Set the "Run Mode" and "Display Mode" in the main interface, and also adjust the "Test Mode" and click the "Start" button. 2. After waiting for a while, you will see the test results, including various parameters of the graphics card. How is furmark qualified? 1. Use a furmark baking machine and check the results for about half an hour. It basically hovers around 85 degrees, with a peak value of 87 degrees and room temperature of 19 degrees. Large chassis, 5 chassis fan ports, two on the front, two on the top, and one on the rear, but only one fan is installed. All accessories are not overclocked. 2. Under normal circumstances, the normal temperature of the graphics card should be between "30-85℃". 3. Even in summer when the ambient temperature is too high, the normal temperature is "50-85℃

How to add running records in keep How to add running records in keep Mar 07, 2024 pm 06:00 PM

How to add running records to keep? You can add running records in the keep application, but most users don’t know how to add running records. Next, the editor brings users a graphic tutorial on how to add running records to keep, for interested users Come and take a look! How to add running records in keep 1. First open keep, click [Me] in the lower right corner of the home page to enter the special area, and select the [Settings] button in the upper right corner; 2. Then jump to the settings function page, slide to select the [keep laboratory] service; 3 , then on the keep lab page, click [Garmin running record entry]; 4. Then on the Garmin running record import page, click the [Sync records] button at the bottom, and select [OK] in the jump window; 5. Finally, click on the next

C++ function parameter type safety check C++ function parameter type safety check Apr 19, 2024 pm 12:00 PM

C++ parameter type safety checking ensures that functions only accept values ​​of expected types through compile-time checks, run-time checks, and static assertions, preventing unexpected behavior and program crashes: Compile-time type checking: The compiler checks type compatibility. Runtime type checking: Use dynamic_cast to check type compatibility, and throw an exception if there is no match. Static assertion: Assert type conditions at compile time.

Join a new Xianxia adventure! 'Zhu Xian 2' 'Wuwei Test' pre-download is now available Join a new Xianxia adventure! 'Zhu Xian 2' 'Wuwei Test' pre-download is now available Apr 22, 2024 pm 12:50 PM

The "Inaction Test" of the new fantasy fairy MMORPG "Zhu Xian 2" will be launched on April 23. What kind of new fairy adventure story will happen in Zhu Xian Continent thousands of years after the original work? The Six Realm Immortal World, a full-time immortal academy, a free immortal life, and all kinds of fun in the immortal world are waiting for the immortal friends to explore in person! The "Wuwei Test" pre-download is now open. Fairy friends can go to the official website to download. You cannot log in to the game server before the server is launched. The activation code can be used after the pre-download and installation is completed. "Zhu Xian 2" "Inaction Test" opening hours: April 23 10:00 - May 6 23:59 The new fairy adventure chapter of the orthodox sequel to Zhu Xian "Zhu Xian 2" is based on the "Zhu Xian" novel as a blueprint. Based on the world view of the original work, the game background is set

How to connect the keep bracelet to WeChat How to connect the keep bracelet to WeChat Mar 07, 2024 pm 05:20 PM

How to connect the keep bracelet to WeChat? In the keep bracelet, you can synchronize data to WeChat. Most users do not know how to connect the WeChat data. Next is the graphic tutorial on how to connect the keep bracelet to WeChat brought by the editor. Interested users come and take a look! How to connect the keep bracelet to WeChat 1. First open the keep app, enter the [My Sports] area and select the button in the upper right corner; 2. Then on the page shown below, click on the bound keep bracelet device; 3. Then jump Go to the interface as shown below and select [WeChat Sports]; 4. Finally, click [Unbind] on the page as shown below to select and connect to WeChat.

How to connect keep to Huawei bracelet How to connect keep to Huawei bracelet Mar 07, 2024 pm 09:46 PM

How to connect keep to Huawei bracelet? You can connect Huawei bracelet in keep software. Most users don’t know how to connect Huawei bracelet. Next is the graphic tutorial of how to connect keep to Huawei bracelet brought by the editor. Interested users come and take a look! How to connect keep to Huawei bracelet 1. First open the keep application, click [Me] in the lower right corner of the main page to enter the special area, and select [Smart Hardware]; 2. Then challenge to the My Smart Device function page, click [Add Device] in the middle; 3. Then on the page of selecting the device you want to add, select the [Smart Bracelet/Watch] function; 4. Finally, on the interface shown below, click on the Huawei watch model to connect.

How to brush running mileage in keep Introduction to the method of brushing running mileage in keep How to brush running mileage in keep Introduction to the method of brushing running mileage in keep Mar 12, 2024 pm 01:28 PM

How to increase running mileage in keep? Keep is a very popular fitness and bodybuilding software that helps users easily build a healthy figure. The software supports data recording of diverse sports. No matter which exercise method you choose, it can record data for you, allowing you to feel the changes brought about by each fitness session and giving you the motivation to persist. When we search while running, the system can also record our running process in real time and generate exercise records. However, many novice friends don’t know how to refresh their running history. In this regard, the editor has brought a detailed introduction to the method, let’s take a look. Introduction to the method of keeping to refresh your running history: 1. Turn on the running function, open KEEP, and click [Running]. 2. Open the settings page and click the settings icon in the upper right corner to open

How to cancel the automatic renewal of keep. How to turn off the keep renewal function on Apple mobile phones. How to cancel the automatic renewal of keep. How to turn off the keep renewal function on Apple mobile phones. Mar 23, 2024 pm 09:10 PM

keep has always been a very professional and easy-to-use sports and fitness platform. It allows everyone to freely choose exercise methods. Everyone can exercise anytime and anywhere. There are no limitations. There are many videos of the entire exercise course. If you can exercise along with the course videos, you can still get good fitness results even if you don't go to the gym. Of course, some courses require you to be a member before you can watch them, that is, you need to open a membership, and about membership. Everyone is still not very clear about the automatic renewal option, so what I will share with you today is the method of keeping to turn off the automatic renewal of membership. You can take a look at it. Keep method to turn off automatic membership renewal: Android phone: 1. Turn on keep

See all articles