too big wp_options table of wordpress in mysql(mariadb)

어느날 점검중…

wordpress에서 사용중인 wp_options 테이블의 크기가 너무 커져있음을 알았다.

 

1. 시스템 상 용량

-rw-r—– 1 mysql mysql 3.0G Oct 29 16:37 wp_options.ibd

이거 뭐지…
이만한 테이블이 아닌데…

 

2. dump  용량

-rw-r–r– 1 mysql mysql 3.0M  Oct 29 16:37 /root/wp_options.sql

 

3. table status

| wp_options | InnoDB | 10 | Dynamic | 733 | 4226513 | 3098034176 | 0 | 65536 | 5242880 | 835210 | 2019-10-29 16:23:27 | NULL | NULL | utf8mb4_unicode_ci | NULL | | |

 

4. dump 내용 확인 (일부 발췌)

도저히 select로 확인해볼 엄두가 안나서 ㅎ
dump 파일의 내용으로 확인
–extended-insert=false 로 dump데이터를 획득 했다.

INSERT INTO `wp_options` VALUES (402422,’_transient_feed_bf6558039e9a7c03e679d9b0aedfbb8d’,’a:4:{s:

이런 내용의 레코드가 몇개(수십개) 있었고
대략 이름은 “_transient_” 로 시작하는 형태

해당 레코드의 글자수가 적게는 “수만개” 부터 많게는 “수십만개(본인의 경우는 40만이상)” 까지도 있었다.

 

5. mysql 내에서 레코드 존재 확인

mysql> select option_name from wp_options where option_name like ‘_transient_%’;
+————————————————————————+
| option_name |
+————————————————————————+
| _transient_codepeople_promote_banner_codepeople-calculated-fields-form |
| _transient_feed_067965b9bdcef7bac6d9288f614fd6b0 |
| _transient_feed_0dc2db25f6a1da7be9fe92a7942b7cc0 |
| _transient_feed_0ebf7b01ed6fa23fdeb8092a08be980d |
| _transient_feed_220e247e243d65bc2abaced6868e8137 |

mysql (jiraknet_wordpress)> select count(*) from wp_options where option_name like ‘_transient_%’;
+———-+
| count(*) |
+———-+
| 15 |
+———-+

 

6. 대체 뭐냐?

대충 “임시 저장 데이터” 정도로 정의 할 수 있겠다.

상황을 보아하니 워드프레스가 임시 데이터를 생성후 삭제하지 않고 남아있는 상태로 보여진다.
(이걸 지우는 플러그인 까지 존재하니 말이다.)

아무리 생각해도 본 데이터는 “필수적”이지 않으며
계속해서 “유지” 해야 할 것이라는 생각은 들지 않았다.

 

7. 삭제하자

delete from wp_options where option_name like ‘_transient_%’

_transient_ 문자열로 시작하는 레코드를 삭제해 버리면 된다.

물론 내가 소개한 방법은 mysql 콘솔에서 “수동”으로 처리 하는 것이고

https://wordpress.org/plugins/search/transient/

에서 적당한 플러그인을 설치하여 사용하면 굳이 귀찮게 콘솔 작업을 할 필요는 없겠다.

 

About KENNETH 19688 Articles
지락문화예술공작단

Be the first to comment

Leave a Reply

Your email address will not be published.


*


이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.