两张表,一个有900万条数据,一个有7万条数据,两张表关联查询时一直处在 optimizing状态。
不是说infobright的查询性能高吗?求解。。
贴下我的建表语句:
CREATE TABLE `wangzj`.`d_http_url_201211` (
`p_id` int(4) DEFAULT '0',
`tm` bigint(20) DEFAULT '0',
`idate` datetime DEFAULT NULL,
`phone` bigint(20) DEFAULT '0',
`ua_id` int(10) DEFAULT '0',
`response_duration` int(10) DEFAULT '0',
`method` int(2) DEFAULT '0',
`imsi` bigint(20) DEFAULT '0',
`imei` char(16) DEFAULT NULL,
`city_code` int(10) DEFAULT NULL,
`host` char(67) DEFAULT NULL,
`path` varchar(512) DEFAULT NULL,
`hits` int(10) DEFAULT '0',
`ipaddr` bigint(20) DEFAULT '0',
`host_ip` bigint(20) DEFAULT NULL,
`apn_id` tinyint(3) DEFAULT '0',
`apn` varchar(45) DEFAULT '0',
`host_id` int(10) DEFAULT '0',
`host_type_id` int(10) DEFAULT '0',
`par_id` int(10) DEFAULT NULL,
`website_id` int(10) DEFAULT NULL,
`rbytes` int(10) DEFAULT NULL,
`sbytes` int(10) DEFAULT NULL,
`s_id` char(10) DEFAULT NULL,
`cell_lac` char(6) DEFAULT NULL,
`cell_ci` char(6) DEFAULT NULL,
`cell_loc_type` int(10) DEFAULT '0',
`rai_lac` char(6) DEFAULT '0',
`rai_rac` char(6) DEFAULT '0',
`net_type` int(10) DEFAULT '0',
`ua` varchar(256) DEFAULT NULL,
`xwp` varchar(256) DEFAULT NULL,
`user_type` int(10) DEFAULT '0',
`online_tm` int(10) DEFAULT '0'
) ENGINE=BRIGHTHOUSE DEFAULT CHARSET=utf8;CREATE TABLE `wangzj`.`xiaoshuo_0104` (
`book_url` varchar(512) DEFAULT NULL,
`bookid` varchar(512) DEFAULT NULL,
`host` varchar(512) DEFAULT NULL,
`uri_title` varchar(512) DEFAULT NULL,
`uri_author` varchar(512) DEFAULT NULL,
`uri_type` varchar(512) DEFAULT NULL,
`uri_type_2` char(50) DEFAULT NULL,
`bookidnum` varchar(100) DEFAULT NULL
) ENGINE=BRIGHTHOUSE DEFAULT CHARSET=utf8;
不是说infobright的查询性能高吗?求解。。
贴下我的建表语句:
CREATE TABLE `wangzj`.`d_http_url_201211` (
`p_id` int(4) DEFAULT '0',
`tm` bigint(20) DEFAULT '0',
`idate` datetime DEFAULT NULL,
`phone` bigint(20) DEFAULT '0',
`ua_id` int(10) DEFAULT '0',
`response_duration` int(10) DEFAULT '0',
`method` int(2) DEFAULT '0',
`imsi` bigint(20) DEFAULT '0',
`imei` char(16) DEFAULT NULL,
`city_code` int(10) DEFAULT NULL,
`host` char(67) DEFAULT NULL,
`path` varchar(512) DEFAULT NULL,
`hits` int(10) DEFAULT '0',
`ipaddr` bigint(20) DEFAULT '0',
`host_ip` bigint(20) DEFAULT NULL,
`apn_id` tinyint(3) DEFAULT '0',
`apn` varchar(45) DEFAULT '0',
`host_id` int(10) DEFAULT '0',
`host_type_id` int(10) DEFAULT '0',
`par_id` int(10) DEFAULT NULL,
`website_id` int(10) DEFAULT NULL,
`rbytes` int(10) DEFAULT NULL,
`sbytes` int(10) DEFAULT NULL,
`s_id` char(10) DEFAULT NULL,
`cell_lac` char(6) DEFAULT NULL,
`cell_ci` char(6) DEFAULT NULL,
`cell_loc_type` int(10) DEFAULT '0',
`rai_lac` char(6) DEFAULT '0',
`rai_rac` char(6) DEFAULT '0',
`net_type` int(10) DEFAULT '0',
`ua` varchar(256) DEFAULT NULL,
`xwp` varchar(256) DEFAULT NULL,
`user_type` int(10) DEFAULT '0',
`online_tm` int(10) DEFAULT '0'
) ENGINE=BRIGHTHOUSE DEFAULT CHARSET=utf8;CREATE TABLE `wangzj`.`xiaoshuo_0104` (
`book_url` varchar(512) DEFAULT NULL,
`bookid` varchar(512) DEFAULT NULL,
`host` varchar(512) DEFAULT NULL,
`uri_title` varchar(512) DEFAULT NULL,
`uri_author` varchar(512) DEFAULT NULL,
`uri_type` varchar(512) DEFAULT NULL,
`uri_type_2` char(50) DEFAULT NULL,
`bookidnum` varchar(100) DEFAULT NULL
) ENGINE=BRIGHTHOUSE DEFAULT CHARSET=utf8;
这是我的查询语句:
SELECT d.phone,x.uri_title,count(1)
FROM d_http_url_201211 d,xiaoshuo_0104 x
where d.host=x.host
group by d.phone,x.uri_title;
没想到也是很慢,查询语句是
SELECT d.phone,x.uri_title,count(1)
FROM d_http_url_201211 d,xiaoshuo_0104 x
where d.host=x.host
group by d.phone,x.uri_title;单查这个大表d_http_url_201211 时速度确实比一般存储引擎快。
FROM d_http_url_201211 d,xiaoshuo_0104 x
where d.host=x.host
group by d.phone,x.uri_title;show index from d_http_url_201211 ;
show index from xiaoshuo_0104 ;贴出以供分析。
1, 'SIMPLE', 'd', 'ALL', '', '', '', '', 9923524, 'Using where; Using join buffer'麻烦了~
我了个去,真的麻烦了,全是ALL
show create table 把表结构也贴出来吧。