Bitmap Index Scan - 인덱스와 테이블 간의 정렬관계가 불량할 때 사용됨.


cluster t1 using t1_ix01 ; -- 인덱스로 테이블 레코드정렬 

 

주의: DML뿐아니라 SELECT 와도 락 호완성이 없다. 

사용자접속을 막고 작업하는 것이 좋다. 

SMALL

'PostgreSQL' 카테고리의 다른 글

CPU 모니터링  (0) 2020.08.02
락 모니터링  (0) 2020.08.01
correlation 조회 (컬럼 정렬상태)  (0) 2020.08.01
인덱스조회  (0) 2020.08.01
PostgeSQL 선언적 파티셔닝 테스트  (0) 2020.06.26
1
2
3
select tablename, attname, correlation
from pg_stats
where tablename = 'mber' ;
cs
SMALL

'PostgreSQL' 카테고리의 다른 글

CPU 모니터링  (0) 2020.08.02
락 모니터링  (0) 2020.08.01
Cluster 명령을 이용한 테이블레코드 정렬  (0) 2020.08.01
인덱스조회  (0) 2020.08.01
PostgeSQL 선언적 파티셔닝 테스트  (0) 2020.06.26
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
--1) 인덱스목록
select *
from pg_indexes i inner join information_schema.columns c
on i.tablename = c.table_name
where i.schemaname='public'
;
 
 
--2) 인덱스컬럼정 
select i.indexname, array_to_string(array_agg(column_name), ',')
from pg_indexes i inner join information_schema.columns c
on i.tablename = c.table_name
where i.schemaname='public'
group by i.indexname
order by i.indexname
;
cs
SMALL

'PostgreSQL' 카테고리의 다른 글

CPU 모니터링  (0) 2020.08.02
락 모니터링  (0) 2020.08.01
Cluster 명령을 이용한 테이블레코드 정렬  (0) 2020.08.01
correlation 조회 (컬럼 정렬상태)  (0) 2020.08.01
PostgeSQL 선언적 파티셔닝 테스트  (0) 2020.06.26
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
drop table 고객 ;
drop table 주문;
 
create table 고객(
    고객번호 varchar2(10primary key,
    고객명 varchar2(100) ,
    연락처 varchar2(12) ,
    거주지역코드 varchar(2)     
) ;
 
create table 주문(
   주문번호 varchar(20primary key ,
   고객번호 varchar2(10not null
   주문일시 timestamp ,
   주문금액 number ,
   배송지 varchar2(100)  ,
   constraint fk_주문 foreign key(고객번호) references 고객(고객번호)      
) partition by range(주문일시)
(
partition p3 values less than (timestamp '2015-04-01 00:00:00.000000' ) ,
partition p4 values less than (timestamp '2015-05-01 00:00:00.000000' ) ,
partition p5 values less than (timestamp '2015-06-01 00:00:00.000000' ) ,
partition p6 values less than (timestamp '2015-07-01 00:00:00.000000' ) ,
partition p7 values less than (timestamp '2015-08-01 00:00:00.000000' ) ,
partition p8 values less than (timestamp '2015-09-01 00:00:00.000000' ) ,
partition p9 values less than (timestamp '2015-10-01 00:00:00.000000' ) ,
partition p10 values less than (timestamp '2015-11-01 00:00:00.000000' ) ,
partition p11 values less than (timestamp '2015-12-01 00:00:00.000000' ) ,
partition p12 values less than (timestamp '2016-01-01 00:00:00.000000' ) ,
partition pmax values less than (maxvalue) ); 
 
 
 
insert into 고객 
select object_id, object_name, '0100001004' , lpad(namespace, 2 ,'0')   from all_objects
where rownum <= 10000 ;
 
update 고객 set 고객명 = '김철수' , 거주지역코드 = '02'
where  고객번호 = '3' ;
 
update 고객 set 고객명 = '홍길동', 거주지역코드 = '05'
where  고객번호 = '6' ;
 
commit;
 
truncate  table 주문;
insert into 주문
select lpad(rownum, 20'0' )
     , round(dbms_random.value(36)) 
     , add_months(created, -24+ rownum 
     , round(dbms_random.value(1000050000)) 
     , object_type 
from all_objects
where rownum <= 20000 ; 
 
select * from 고객;
select * from 주문;
 
 
select /*+ ordered gather_plan_statistics*/o.주문일시, o.주문번호, c.고객번호, c.고객명, c.연락처, o.주문금액, o.배송지
from 고객 c, 주문 o 
where o.주문일시 between to_date('20150301''yyyymmdd')
and to_date('20150314235959''yyyymmddhh24miss')
and o.고객번호 = c.고객번호
and c.거주지역코드 || c.고객명 in ('02김철수''05홍길동')
order by o.주문일시, c.고객명 ;
------------------------------------------------------------------------------------------------------------------------
--| Id  | Operation                | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
------------------------------------------------------------------------------------------------------------------------
--|   0 | SELECT STATEMENT         |      |      1 |        |      1 |00:00:00.03 |     108 |       |       |          |
--|   1 |  SORT ORDER BY           |      |      1 |      1 |      1 |00:00:00.03 |     108 |  2048 |  2048 | 2048  (0)|
--|*  2 |   HASH JOIN              |      |      1 |      1 |      1 |00:00:00.03 |     108 |  1335K|  1335K|  538K (0)|
--|*  3 |    TABLE ACCESS FULL     | 고객 |      1 |    199 |      2 |00:00:00.02 |      68 |       |       |          |
--|   4 |    PARTITION RANGE SINGLE|      |      1 |      1 |      6 |00:00:00.01 |      37 |       |       |          |
--|*  5 |     TABLE ACCESS FULL    | 주문 |      1 |      1 |      6 |00:00:00.01 |      37 |       |       |          |
------------------------------------------------------------------------------------------------------------------------
 
select /*+ ordered gather_plan_statistics*/o.주문일시, o.주문번호, c.고객번호, c.고객명, c.연락처, o.주문금액, o.배송지
from 고객 c, 주문 o 
where o.주문일시 between to_date('20150301''yyyymmdd')
and to_date('20150314235959''yyyymmddhh24miss')
and o.고객번호 = c.고객번호
--and c.거주지역코드 || c.고객명 in ('02김철수', '05홍길동')
and (c.거주지역코드 , c.고객명 ) in ( ('02','김철수'), ('05','홍길동'))
order by o.주문일시, c.고객명 ;
 
create index 고객_ix01 on 고객(거주지역코드, 고객명) ;
create index 주문_ix01 on 주문(고객번호, 주문일시) ;
--주문 글로벌인덱스 사용
---------------------------------------------------------------------------------------------------------------------------------------------------
--| Id  | Operation                               | Name    | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |  OMem |  1Mem | Used-Mem |
---------------------------------------------------------------------------------------------------------------------------------------------------
--|   0 | SELECT STATEMENT                        |         |      1 |        |      1 |00:00:00.01 |      10 |     19 |       |       |          |
--|   1 |  SORT ORDER BY                          |         |      1 |      1 |      1 |00:00:00.01 |      10 |     19 |  2048 |  2048 | 2048  (0)|
--|   2 |   NESTED LOOPS                          |         |      1 |      1 |      1 |00:00:00.01 |      10 |     19 |       |       |          |
--|   3 |    NESTED LOOPS                         |         |      1 |      1 |      1 |00:00:00.01 |       9 |     19 |       |       |          |
--|   4 |     INLIST ITERATOR                     |         |      1 |        |      2 |00:00:00.01 |       5 |      8 |       |       |          |
--|   5 |      TABLE ACCESS BY INDEX ROWID BATCHED| 고객    |      2 |      1 |      2 |00:00:00.01 |       5 |      8 |       |       |          |
--|*  6 |       INDEX RANGE SCAN                  | 고객_IX0|      2 |      1 |      2 |00:00:00.01 |       4 |      8 |       |       |          |
--|*  7 |     INDEX RANGE SCAN                    | 주문_IX0|      2 |      1 |      1 |00:00:00.01 |       4 |     11 |       |       |          |
--|   8 |    TABLE ACCESS BY GLOBAL INDEX ROWID   | 주문    |      1 |      1 |      1 |00:00:00.01 |       1 |      0 |       |       |          |
---------------------------------------------------------------------------------------------------------------------------------------------------
 
--주문 로컬인덱스 사용
drop index 주문_ix01 ;
create index 주문_x1 on 주문(고객번호, 주문일시) local ;
------------------------------------------------------------------------------------------------------------------------------------------
--| Id  | Operation                               | Name    | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
------------------------------------------------------------------------------------------------------------------------------------------
--|   0 | SELECT STATEMENT                        |         |      1 |        |      1 |00:00:00.01 |       8 |       |       |          |
--|   1 |  SORT ORDER BY                          |         |      1 |      1 |      1 |00:00:00.01 |       8 |  2048 |  2048 | 2048  (0)|
--|   2 |   NESTED LOOPS                          |         |      1 |      1 |      1 |00:00:00.01 |       8 |       |       |          |
--|   3 |    NESTED LOOPS                         |         |      1 |      1 |      1 |00:00:00.01 |       7 |       |       |          |
--|   4 |     INLIST ITERATOR                     |         |      1 |        |      2 |00:00:00.01 |       5 |       |       |          |
--|   5 |      TABLE ACCESS BY INDEX ROWID BATCHED| 고객    |      2 |      1 |      2 |00:00:00.01 |       5 |       |       |          |
--|*  6 |       INDEX RANGE SCAN                  | 고객_IX0|      2 |      1 |      2 |00:00:00.01 |       4 |       |       |          |
--|   7 |     PARTITION RANGE SINGLE              |         |      2 |      1 |      1 |00:00:00.01 |       2 |       |       |          |
--|*  8 |      INDEX RANGE SCAN                   | 주문_X1 |      2 |      1 |      1 |00:00:00.01 |       2 |       |       |          |
--|   9 |    TABLE ACCESS BY LOCAL INDEX ROWID    | 주문    |      1 |      1 |      1 |00:00:00.01 |       1 |       |       |          |
------------------------------------------------------------------------------------------------------------------------------------------
 
 
select /*+ ordered  use_concat gather_plan_statistics*/o.주문일시, o.주문번호, c.고객번호, c.고객명, c.연락처, o.주문금액, o.배송지
from 고객 c, 주문 o 
where o.주문일시 between to_date('20150301''yyyymmdd')
and to_date('20150314235959''yyyymmddhh24miss')
and o.고객번호 = c.고객번호
--and c.거주지역코드 || c.고객명 in ('02김철수', '05홍길동')
--and (c.거주지역코드 , c.고객명 ) in ( ('02','김철수'), ('05','홍길동'))
and ((c.거주지역코드 = '02' and c.고객명 = '김철수') or (c.거주지역코드 = '03' and  c.고객명 = '홍길동') )
order by o.주문일시, c.고객명 ;
 
------------------------------------------------------------------------------------------------------------------------------------------
--| Id  | Operation                               | Name    | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
------------------------------------------------------------------------------------------------------------------------------------------
--|   0 | SELECT STATEMENT                        |         |      1 |        |      1 |00:00:00.01 |       7 |       |       |          |
--|   1 |  SORT ORDER BY                          |         |      1 |      1 |      1 |00:00:00.01 |       7 |  2048 |  2048 | 2048  (0)|
--|   2 |   NESTED LOOPS                          |         |      1 |      1 |      1 |00:00:00.01 |       7 |       |       |          |
--|   3 |    NESTED LOOPS                         |         |      1 |      1 |      1 |00:00:00.01 |       6 |       |       |          |
--|   4 |     INLIST ITERATOR                     |         |      1 |        |      1 |00:00:00.01 |       5 |       |       |          |
--|   5 |      TABLE ACCESS BY INDEX ROWID BATCHED| 고객    |      2 |      1 |      1 |00:00:00.01 |       5 |       |       |          |
--|*  6 |       INDEX RANGE SCAN                  | 고객_IX0|      2 |      1 |      1 |00:00:00.01 |       4 |       |       |          |
--|   7 |     PARTITION RANGE SINGLE              |         |      1 |      1 |      1 |00:00:00.01 |       1 |       |       |          |
--|*  8 |      INDEX RANGE SCAN                   | 주문_X1 |      1 |      1 |      1 |00:00:00.01 |       1 |       |       |          |
--|   9 |    TABLE ACCESS BY LOCAL INDEX ROWID    | 주문    |      1 |      2 |      1 |00:00:00.01 |       1 |       |       |          |
------------------------------------------------------------------------------------------------------------------------------------------
 
--Predicate Information (identified by operation id):
-----------------------------------------------------
--
--6 - access(("C"."고객명"='김철수' AND "C"."거주지역코드"='02' OR "C"."고객명"='홍길동' AND "C"."거주지역코드"='03'))
--8 - access("O"."고객번호"="C"."고객번호" AND "O"."주문일시">=TIMESTAMP' 2015-03-01 00:00:00' AND "O"."주문일시"<=TIMESTAMP' 2015-03-14
--23:59:59')
 
select * from table(dbms_xplan.display_cursor(nullnull'allstats last')) ;
 
 
 
cs

조건절을 가공하면 인덱스를 사용할 수 없다.

OR 또는 UNION ALL 을 사용할 수 있다. OR 사용시 USE_CONCAT 힌트를 같이사용해야 한다.

주문은 파티션 테이블이다. 위와 같을때 일반글로벌인덱스보다 로컬 Nonprefixed 인덱스가 유용할 수 있다.

정확히 하나의 파티션만 읽는다.

보기와 같을때 인덱스는 고객번호 + 주문일시로 하자 , 주문일시를 선두조건으로 두면 데이터가 흩어지므로

인덱스 스캔시 비효율이 발생할 수 있다.

 

SMALL

'Oracle' 카테고리의 다른 글

Real-Time SQL Monitoring  (0) 2020.10.19
Database Sample Schemas  (0) 2020.09.26
Oracle_Home 경로 확인  (0) 2020.08.08
SQLP - SQL자격검정실전문제 실기문제1 풀이  (0) 2020.06.29
Oracle 히든파라미터 조회방법  (0) 2020.06.26

drop table 월별지점매출 purge ;

create table  월별지점매출 (
  지점 number ,
  판매월 number ,
  매출 number
) ;

insert into 월별지점매출
select 10, 1, 521 from dual  union all
select 10, 2, 684 from dual  union all
select 10, 3, 590 from dual  union all
select 20, 1, 537 from dual  union all
select 20, 2, 650 from dual  union all
select 20, 3, 500 from dual  union all
select 20, 4, 919 from dual  union all
select 20, 5, 658 from dual  union all
select 30, 1, 631 from dual  union all 
select 30, 2, 736 from dual  union all 
select 30, 3, 513 from dual  union all 
select 30, 4, 970 from dual  union all 
select 30, 5, 939 from dual  union all 
select 30, 6, 666 from dual  ;

select * from 월별지점매출 ;

각 지점별로 판매월과 함께 증가하는 누적매출을 구하는 SQL 을 아래 두가지 방식으로 작성하시오.

1) 윈도우함수를 이용한 방식으로 작성

2) 윈도우함수나 스칼라서브쿼리를 지원하지않는 DBMS에서 활용할 수 있는 방식으로 작성 

 

아래와 같은결과를 만드시오.

1)

select a.지점
     , a.판매월
     , a.매출
     , sum(a.매출) over (partition by 지점 order by 판매월 ) 누적매출
from 월별지점매출 a ;

 

윈도우함수는 partition by절을 정확하게 작성하는것이 중요하다.

sum(a.매출) over (partition by 지점 order by 판매월 )

= sum(a.매출) over (partition by 지점 order by 판매월 range between unbounded preceding and current row)

 

2)

select a.지점
     , a.판매월
     , a.매출   
     , sum(b.매출)  누적매출
from 월별지점매출 a 
inner join  월별지점매출 b
on a.지점 = b.지점 
and a.판매월 >= b.판매월 
group by a.지점, a.판매월, a.매출  
order by a.지점, a.판매월 ;

 

누적매출인 b.매출의 합계는 a.판매월 보다 작거나 같아야 한다.

예를들어 3월보다 작아야 3월까지의 누적매출 합계가 만들어진다.

SMALL

'Oracle' 카테고리의 다른 글

Real-Time SQL Monitoring  (0) 2020.10.19
Database Sample Schemas  (0) 2020.09.26
Oracle_Home 경로 확인  (0) 2020.08.08
SQLP - SQL자격검정실전문제 실기문제2 풀이  (0) 2020.06.30
Oracle 히든파라미터 조회방법  (0) 2020.06.26

안녕하세요.오늘의 내용은  LIMIT 입니다.

 

select * 

from employees ignore index(employees_ix02)

where hire_date between '1986-05-02' and '1986-10-31'   -- 건수 1092

order by hire_date desc

limit 10 ; 

 

limit 조건은 오라클의 rownum 과 비슷하긴 하지만 작동하는 방식이 다르기 때문에 주의가 필요합니다.

 

위 쿼리의 순서입니다.

1.employees 테이블에서 where 조건에 만족하는 레코드를 전부 읽습니다

2.읽어온 레코드를 hire_date  내림차순으로 정렬합니다

3.정렬된 결과에서 상위 10건을 채우면 바로 반환합니다.

 

Limit 은 where 조건이 아니므로 항상 마지막에 수행합니다.

또한 쿼리에서 모든 레코드의 정렬이 완료되지 않았다 하더라도 limit 에서 필요한 레코드가 준비되면 

바로 쿼리를 종료시킵니다.

즉, 상위 10개를 채우면 더 이상 정렬하지 않고 사용자에게 결과를 보냄

 

limt을 사용하는 쿼리의 케이스별로 어떻게 동작하는지 살펴보겠습니다. 

 

아래는 쿼리 수행 전 후 Sort 누적 현황을 보여줍니다. 

-- 1 수행전 sort 누적현황

show session status like 'Sort%' ;

-- Sort_merge_passes 

-- Sort_range 0

-- Sort_rows 734

-- Sort_scan 76

 

-- 1 수행후 sort 누적현황 (full table scan 사용)

select * 

from employees ignore index(employees_ix02)

where hire_date between '1986-05-02' and '1986-10-31'   -- 건수 1092

order by hire_date desc 

limit 10; 

 

show session status like 'Sort%' ;

-- Sort_merge_passes 0

-- Sort_range 0

-- Sort_rows 744  --> (+10) 정렬횟수증가되었으나 limit 조건으로 인해 정렬횟수는 10 으로 제한  

-- Sort_scan 77   --> (+1)  테이블풀스캔을 사용한 결과로 정렬수행한 횟수 1 증가

 

인덱스가 없어 풀테이블스캔으로 결과를 가져오지만 1092건 전체를 정렬하지 않고도 멈춤

그래서 limit 을 하면 쿼리의 작업량을 상당히 줄여주는 역할은 가능합니다.

하지만 정렬은 피할 수가 없습니다.  

 

 

 

-- 2 수행전 sort 누적현황

show session status like 'Sort%' ;

-- Sort_merge_passes 0

-- Sort_range 0

-- Sort_rows 744

-- Sort_scan 77

 

create index employees_ix02 on employees(hire_date);  

select * 

from employees use index(employees_ix02) -- > 인덱스사용

where hire_date between '1986-05-02' and '1986-10-31'   -- 건수 1092

order by hire_date desc 

limit 10;

 

-- 2 수행후 sort 누적현황 (employees_ix02 사용)

show session status like 'Sort%' ;

-- Sort_merge_passes 0

-- Sort_range 0

-- Sort_rows 744

-- Sort_scan 77 

 

--> 정렬횟수 증가 없음 

-- employees_ix02 인덱스를 이용해 스트리밍방식으로 처리되면 정렬횟수가 증가하지 않음 (즉, 결과가 이미 정렬되어 있어 정렬과정자체가 불필요함)

 

-- 3 order by 에 인덱스에 포함되지 않는 last_nmae 추가 

select * 

from employees use index(employees_ix02)

where hire_date between '1986-05-02' and '1986-10-31'   -- 건수 1092

order by hire_date desc, last_name  

limit 10;

 

-- 3 수행후 sort 누적현황 (employees_ix02 사용)

show session status like 'Sort%' ; 

-- Sort_merge_passes 0

-- Sort_range 1

-- Sort_rows 754 -- > (+10) 

-- Sort_scan 77 

SMALL

'MySQL-MariaDB' 카테고리의 다른 글

Hash Join  (0) 2020.08.29
MaraDB 지식베이스 - table_open_cache 최적화  (0) 2020.08.23
MySQL 진단시 고려할 부분  (0) 2020.08.22
MySQL 테스트 데이터복제  (0) 2020.08.17
innoDB Buffer Usage가 100%를 유지하는 현상  (0) 2020.06.26

partitioning test.pas
0.01MB

메모장 또는 아크로에딧으로 열기 

SMALL

'PostgreSQL' 카테고리의 다른 글

CPU 모니터링  (0) 2020.08.02
락 모니터링  (0) 2020.08.01
Cluster 명령을 이용한 테이블레코드 정렬  (0) 2020.08.01
correlation 조회 (컬럼 정렬상태)  (0) 2020.08.01
인덱스조회  (0) 2020.08.01

sqlplus sys/sys as sysdba

 

col name for a34

col value for a15

col descrition for a30

col is_default for a15

col ses_modifiable for a15

col sys_modifiable for a15

 

select ksppinm name, ksppstvl value, ksppstdf is_default, decode(bitand(ksppiflg/256,1),1,'true','false') ses_modifiable, decode(bitand(ksppiflg/65536,3),1,'immediate',2,'deferred',3,'immediate','false') sys_modifiable, ksppdesc descrition from sys.x$ksppi i, sys.x$ksppcv v

where i.indx = v.indx and i.ksppinm like '%&1%';

 

또는 

 

select ksppinm name,
       ksppstvl value,
       ksppstdf is_default
from   sys.x$ksppi i, sys.x$ksppcv v
where i.indx = v.indx 
and ksppinm like '%query_execution%';

SMALL

'Oracle' 카테고리의 다른 글

Real-Time SQL Monitoring  (0) 2020.10.19
Database Sample Schemas  (0) 2020.09.26
Oracle_Home 경로 확인  (0) 2020.08.08
SQLP - SQL자격검정실전문제 실기문제2 풀이  (0) 2020.06.30
SQLP - SQL자격검정실전문제 실기문제1 풀이  (0) 2020.06.29

mysql 모니터링 중 innoDB Buffer Usage가 100%를 유지하는 현상이 발생

 

아래 공식대로 계산 후  innodb_buffer_pool_size 를 변경

 

SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_pages_data'; -- IBPDataPages SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_pages_total'; -- IBPTotalPages SHOW GLOBAL STATUS LIKE 'Innodb_page_size'; -- IPS

IBPPctFull = IBPDataPages * 100.0 / IBPTotalPages

 

IBPctFull이 95%이상일 경우 DB 서버 RAM의 75%까지 innodb_buffer_pool_size를 설정.

 

 IBPctFull이 95%이하일 경우 IBPSize = IPS X IBPDataPages / (1024*1024*1024) X 1.05 의 계산 값을 innodb_buffer_pool_size로 설정.

 

 

[참조] - http://dba.stackexchange.com/questions/19164/what-to-set-innodb-buffer-pool-and-why

출처: https://gihyun.com/16 [Note]

 

현재rds 사양기준으로 r5 2X large
aws 자동계산

64GB / 46GB -> 71.8% 할당
innodb_buffer_pool_size 사용률 --> 98.7%

innodb_buffer_pool_size 적정한 사용률은  ?

적정사용률을 유지하기 위해 

인스턴스사양을 한단계 늘리는것과 
innodb_buffer_pool_size 를 75% 이상이 되도록 수동으로 설정하는 것 중 권장되는 방법은 무었일까?

 

-- inodb_buffer_pool_size 계산방법
show global status like 'Innodb_buffer_pool_pages_data'; -- IBPDataPages  2976794
show global status like 'Innodb_buffer_pool_pages_total';-- IBPTotalPages 3014656
SHOW GLOBAL STATUS LIKE 'Innodb_page_size'; -- IPS 16384

 

사용률 95% 이상인경우 : 전체DB서버 RAM의  75% 유지하도록 Innodb_page_size 할당 

select 2976794 * 100.0 / 3014656 as IBPPctFull from dual ; -- 98.7 %  

 

show global variables like 'innodb_buffer%' ;  -- 46GB (기존) 71.8% 할당된상태 

사이즈변경함 : Innodb_page_size (53392123904)   49.7GB 할당   --> 사용률  98.7 %  --> 90.8% 유지

 

사용률 95% 이하인경우

select 16384 * 2976794 / (1024*1024*1024) * 1.05 ; -- Innodb_page_size 할당  47.69 

SMALL

'MySQL-MariaDB' 카테고리의 다른 글

Hash Join  (0) 2020.08.29
MaraDB 지식베이스 - table_open_cache 최적화  (0) 2020.08.23
MySQL 진단시 고려할 부분  (0) 2020.08.22
MySQL 테스트 데이터복제  (0) 2020.08.17
MySQL - Limit 에 대하여...  (0) 2020.06.26

+ Recent posts