milano | mysql> show variables like '%mroonga_version%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| mroonga_version | 5.12 |
+-----------------+-------+
mysql> select * from information_schema.TABLES where TABLE_NAME = 'SearchItems'\G
*************************** 1. row ***************************
TABLE_CATALOG: def
TABLE_NAME: SearchItems
TABLE_TYPE: BASE TABLE
ENGINE: Mroonga
VERSION: 10
ROW_FORMAT: Dynamic
TABLE_ROWS: 2332764
AVG_ROW_LENGTH: 0
DATA_LENGTH: 2518052864
MAX_DATA_LENGTH: 0
INDEX_LENGTH: 0
DATA_FREE: 0
AUTO_INCREMENT: NULL
CREATE_TIME: NULL
UPDATE_TIME: NULL
CHECK_TIME: NULL
TABLE_COLLATION: utf8_general_ci
CHECKSUM: NULL
CREATE_OPTIONS:
TABLE_COMMENT:
1 row in set (0.06 sec)
mysql> show create table SearchItems;
| SearchItems | CREATE TABLE `SearchItems` (
`ItemId` int(10) unsigned NOT NULL,
`NewsId` varchar(150) NOT NULL,
`DeliverDate` datetime NOT NULL,
`HeadLine` varchar(255) NOT NULL,
`SubHeadLine` varchar(255) DEFAULT NULL,
`Body` mediumtext NOT NULL,
`GenreInformation` text NOT NULL,
`LastUpdated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`UnixTime` int(10) unsigned DEFAULT NULL,
`CreateUser` int(10) unsigned DEFAULT NULL,
`ModifyUser` int(10) unsigned DEFAULT NULL,
`PublishRange` tinyint(3) unsigned DEFAULT NULL,
`PublishFlg` tinyint(1) DEFAULT NULL,
`Status` tinyint(1) DEFAULT NULL,
`IsKantele` tinyint(1) DEFAULT NULL,
`SendRestricts` tinyint(1) DEFAULT NULL,
`CompanyId` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`ItemId`),
KEY `NewsId` (`NewsId`),
KEY `DeliverDate` (`DeliverDate`),
KEY `LastUpdated` (`LastUpdated`),
KEY `UnixTime` (`UnixTime`),
KEY `CreateUser` (`CreateUser`),
KEY `ModifyUser` (`ModifyUser`),
KEY `PublishRange` (`PublishRange`),
KEY `PublishFlg` (`PublishFlg`),
KEY `Status` (`Status`),
KEY `IsKantele` (`IsKantele`),
KEY `SendRestricts` (`SendRestricts`),
KEY `CompanyId` (`CompanyId`),
FULLTEXT KEY `HeadLine` (`HeadLine`) COMMENT 'parser "TokenBigram", normalizer "NormalizerAuto"',
FULLTEXT KEY `SubHeadLine` (`SubHeadLine`) COMMENT 'parser "TokenBigram", normalizer "NormalizerAuto"',
FULLTEXT KEY `Body` (`Body`) COMMENT 'parser "TokenBigram", normalizer "NormalizerAuto"',
FULLTEXT KEY `GenreInformation` (`GenreInformation`) COMMENT 'parser "TokenBigram", normalizer "NormalizerAuto"',
FULLTEXT KEY `Head_Sub` (`HeadLine`,`SubHeadLine`) COMMENT 'parser "TokenBigram", normalizer "NormalizerAuto"',
FULLTEXT KEY `Head_Sub_Body` (`HeadLine`,`SubHeadLine`,`Body`) COMMENT 'parser "TokenBigram", normalizer "NormalizerAuto"'
) ENGINE=Mroonga DEFAULT CHARSET=utf8
このようなテーブルに対して、DELETE文・INSERT文の実行が遅くて頭を悩ましています。 古いシステムなため、古いmroongaで恥ずかしい限りです。 slow queryの一例はこんな感じです。
Time: 230825 10:06:15
User@Host: root[root] @ [127.0.0.1] Id: 6321625
Query_time: 26.651038 Lock_time: 0.000027 Rows_sent: 0 Rows_examined: 2
SET timestamp=1692925575; DELETE FROM SearchItems WHERE ItemId=2887131;
Time: 230825 10:07:20
User@Host: root[root] @ [127.0.0.1] Id: 6321740
Query_time: 49.110938 Lock_time: 0.000069 Rows_sent: 0 Rows_examined: 0
SET timestamp=1692925640; INSERT INTO SearchItems(ItemId,NewsId,DeliverDate,HeadLine,SubHeadLine,Body,GenreInformation,LastUpdated,UnixTime,CreateUser,ModifyUser,PublishRange,PublishFlg,Status,IsKantele,SendRestricts,CompanyId) VALUES(省略);
上記は特に遅いケースですが、日常的に5秒程度かかるケースが頻発しています。 遅い原因と調査方法、解決策などのアドバイスがあればご教授いただきたいです。
| 01:32:38 |
milano | * mysql> show variables like '%mroonga_version%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| mroonga_version | 5.12 |
+-----------------+-------+
mysql> select * from information_schema.TABLES where TABLE_NAME = 'SearchItems'\G
*************************** 1. row ***************************
TABLE_CATALOG: def
TABLE_NAME: SearchItems
TABLE_TYPE: BASE TABLE
ENGINE: Mroonga
VERSION: 10
ROW_FORMAT: Dynamic
TABLE_ROWS: 2332764
AVG_ROW_LENGTH: 0
DATA_LENGTH: 2518052864
MAX_DATA_LENGTH: 0
INDEX_LENGTH: 0
DATA_FREE: 0
AUTO_INCREMENT: NULL
CREATE_TIME: NULL
UPDATE_TIME: NULL
CHECK_TIME: NULL
TABLE_COLLATION: utf8_general_ci
CHECKSUM: NULL
CREATE_OPTIONS:
TABLE_COMMENT:
1 row in set (0.06 sec)
mysql> show create table SearchItems;
| SearchItems | CREATE TABLE `SearchItems` (
`ItemId` int(10) unsigned NOT NULL,
`NewsId` varchar(150) NOT NULL,
`DeliverDate` datetime NOT NULL,
`HeadLine` varchar(255) NOT NULL,
`SubHeadLine` varchar(255) DEFAULT NULL,
`Body` mediumtext NOT NULL,
`GenreInformation` text NOT NULL,
`LastUpdated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`UnixTime` int(10) unsigned DEFAULT NULL,
`CreateUser` int(10) unsigned DEFAULT NULL,
`ModifyUser` int(10) unsigned DEFAULT NULL,
`PublishRange` tinyint(3) unsigned DEFAULT NULL,
`PublishFlg` tinyint(1) DEFAULT NULL,
`Status` tinyint(1) DEFAULT NULL,
`IsKantele` tinyint(1) DEFAULT NULL,
`SendRestricts` tinyint(1) DEFAULT NULL,
`CompanyId` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`ItemId`),
KEY `NewsId` (`NewsId`),
KEY `DeliverDate` (`DeliverDate`),
KEY `LastUpdated` (`LastUpdated`),
KEY `UnixTime` (`UnixTime`),
KEY `CreateUser` (`CreateUser`),
KEY `ModifyUser` (`ModifyUser`),
KEY `PublishRange` (`PublishRange`),
KEY `PublishFlg` (`PublishFlg`),
KEY `Status` (`Status`),
KEY `IsKantele` (`IsKantele`),
KEY `SendRestricts` (`SendRestricts`),
KEY `CompanyId` (`CompanyId`),
FULLTEXT KEY `HeadLine` (`HeadLine`) COMMENT 'parser "TokenBigram", normalizer "NormalizerAuto"',
FULLTEXT KEY `SubHeadLine` (`SubHeadLine`) COMMENT 'parser "TokenBigram", normalizer "NormalizerAuto"',
FULLTEXT KEY `Body` (`Body`) COMMENT 'parser "TokenBigram", normalizer "NormalizerAuto"',
FULLTEXT KEY `GenreInformation` (`GenreInformation`) COMMENT 'parser "TokenBigram", normalizer "NormalizerAuto"',
FULLTEXT KEY `Head_Sub` (`HeadLine`,`SubHeadLine`) COMMENT 'parser "TokenBigram", normalizer "NormalizerAuto"',
FULLTEXT KEY `Head_Sub_Body` (`HeadLine`,`SubHeadLine`,`Body`) COMMENT 'parser "TokenBigram", normalizer "NormalizerAuto"'
) ENGINE=Mroonga DEFAULT CHARSET=utf8
このようなテーブルに対して、DELETE文・INSERT文の実行が遅くて頭を悩ましています。 古いシステムなため、古いmroongaで恥ずかしい限りです。 slow queryの一例はこんな感じです。
# Time: 230825 10:06:15
# User@Host: root\[root\] @ \[127.0.0.1\] Id: 6321625
# Query\_time: 26.651038 Lock\_time: 0.000027 Rows\_sent: 0 Rows\_examined: 2
SET timestamp=1692925575;
DELETE FROM SearchItems WHERE ItemId=2887131;
# Time: 230825 10:07:20
# User@Host: root\[root\] @ \[127.0.0.1\] Id: 6321740
# Query\_time: 49.110938 Lock\_time: 0.000069 Rows\_sent: 0 Rows\_examined: 0
SET timestamp=1692925640;
INSERT INTO SearchItems(ItemId,NewsId,DeliverDate,HeadLine,SubHeadLine,Body,GenreInformation,LastUpdated,UnixTime,CreateUser,ModifyUser,PublishRange,PublishFlg,Status,IsKantele,SendRestricts,CompanyId) VALUES(省略);
上記は特に遅いケースですが、日常的に5秒程度かかるケースが頻発しています。 遅い原因と調査方法、解決策などのアドバイスがあればご教授いただきたいです。
| 01:33:23 |