0
我有mysql查詢掛起發送數據階段。當分析慢查詢日誌MYSQL查詢掛起發送狀態
Rows_sent:176975081
Rows_examined:408406766個
行的這些數字是比的行數大於存在於表中。
下面是該查詢
select md.Event_id,db.Listing_ID,db.original_date,
DATE_FORMAT(ed.event_date, '%m-%d-%Y') AS 'EventDate',
datediff(ed.event_date,db.original_date),
zn.zonename,
sn.sectionname,
rn.Row_Name,
db.original_price,
db.last_date,
db.last_price,
(1 - (original_price/Last_Price)) as 'PercentChange'
from market_data as md
inner join id_result as db
on db.id=md.id
left join
zonename zn ON md.zn_id = zn.zoneId
inner JOIN
rowname rn ON md.RN_ID = rn.RN_ID
inner JOIN
sectionname sn ON md.SN_ID = sn.SN_ID
inner JOIN
event_data ed ON md.Event_id = ed.Event_id
where md.dirtyTicketInd=0
下面是表結構
'CREATE TABLE `id_result` (
`id` int(11) NOT NULL,
`listing_id` int(20) DEFAULT NULL,
`original_date` date DEFAULT NULL,
`original_price` decimal(10,2) DEFAULT NULL,
`last_date` date DEFAULT NULL,
`last_price` decimal(10,2) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `listing_id` (`listing_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1'
'CREATE TABLE `market_data` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`currentPrice` varchar(10) NOT NULL DEFAULT ''0'',
`SN_ID` int(11) NOT NULL,
`quantity` tinyint(2) NOT NULL DEFAULT ''0'',
`seatNumbers` varchar(60) NOT NULL DEFAULT ''0'',
`ZN_ID` int(11) NOT NULL,
`listingAttributeList` varchar(15) NOT NULL DEFAULT ''0'',
`listingAttributeCategoryList` varchar(15) NOT NULL DEFAULT ''0'',
`deliveryTypeList` varchar(15) NOT NULL DEFAULT ''0'',
`ticketClass` varchar(15) NOT NULL DEFAULT ''0'',
`dirtyTicketInd` tinyint(4) NOT NULL DEFAULT ''0'',
`splitOption` tinyint(2) NOT NULL DEFAULT ''0'',
`ticketSplit` tinyint(3) NOT NULL DEFAULT ''0'',
`splitVector` varchar(40) NOT NULL DEFAULT ''0'',
`sellerOwnInd` tinyint(3) NOT NULL DEFAULT ''0'',
`faceValue` varchar(25) NOT NULL DEFAULT ''0'',
`serviceFee` varchar(15) NOT NULL DEFAULT ''0'',
`deliveryFee` varchar(12) NOT NULL DEFAULT ''0'',
`totalCost` varchar(25) NOT NULL DEFAULT ''0'',
`score` decimal(12,7) NOT NULL DEFAULT ''0.0000000'',
`seller_price` decimal(10,5) NOT NULL DEFAULT ''0.00000'',
`Event_id` int(11) DEFAULT NULL,
`RN_ID` int(11) NOT NULL,
`SSN_ID` int(11) NOT NULL,
`LI_ID` int(11) NOT NULL,
`TS_ID` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `SSN_ID` (`SSN_ID`),
KEY `SN_ID` (`SN_ID`),
KEY `ZN_ID` (`ZN_ID`),
KEY `event_id` (`Event_id`),
KEY `ts_id` (`TS_ID`),
KEY `LI_ID` (`LI_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=218909923 DEFAULT CHARSET=utf16'
Marketdata大小有9000萬行,id_result大小約爲3000萬行 –
TicketInd = 0時,來自market_data的記錄數是多少? – Alexei
它大約等於89645674或9000萬行,你可以說 –