两张表,一个有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;

解决方案 »

  1.   

    infobright是做数据库仓库分析的  统计数据性能高 如sum count  group by等由于是劣势存储的 并且无索引 所有oltp的查询效率是非常低的 举个不恰当的例子 别拿兔子和乌龟比谁在水下呆的时间长
      

  2.   

    我就是想做数据分析的,分析也会有表间的关联分析。
    这是我的查询语句:
    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;
      

  3.   

    就是因为在一般MySQL存储引擎下,关联这两张大表查询很慢,所以才想看看在infobright下是否速度快点,
    没想到也是很慢,查询语句是
    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 时速度确实比一般存储引擎快。
      

  4.   

    explain 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;show index from d_http_url_201211 ;
    show index from xiaoshuo_0104 ;贴出以供分析。
      

  5.   

    1, 'SIMPLE', 'x', 'ALL', '', '', '', '', 73299, 'Using temporary; Using filesort'
    1, 'SIMPLE', 'd', 'ALL', '', '', '', '', 9923524, 'Using where; Using join buffer'麻烦了~
      

  6.   


    我了个去,真的麻烦了,全是ALL
    show create table 把表结构也贴出来吧。