使用MySQL 5.6而不是5.7

时间:2017-06-08 11:01:15

标签: mysql

我有2个主要表格(professional_account& professional_profile)和3个子表格(prof_knows_aboutprof_keywords& prof_recent_jobs 1:很多关于professional_profile

FT搜索应匹配professional_profile.professional_statement中的搜索词,或者prof_knows_about.knowledge_desc的任何行(针对该professional_id),或者prof_keywords.keyword的任何行或prof_recent_jobs.job_title的任何行

在5.6.35服务器中,它按预期工作,但在5.7.10中,如果搜索项位于professional_profile.professional_statement或prof_knows_about.knowledge_desc中,我只会得到结果 - 在其他两个表中找不到搜索词。两个服务器都在freeBSD UNIX上运行。

我尝试将两个服务器粘贴到shell中。两者也提供相同的EXPLAIN输出。使用5.6上5.7的转储来确保相同的数据和表创建。

我在两台服务器上都显示了变量,但很难比较,因为5.7中有很多额外的值。将两者都设置为相同的sql_mode。

下面列出的表格,查询和解释。

这是我的查询或我的5.7服务器的问题吗?

select email,  PROFILE.*
    FROM professional_account as ACC 
    join professional_profile as PROFILE on ACC.professional_id=PROFILE.professional_id 
    join prof_knows_about as KNOWS on PROFILE.professional_id=KNOWS.professional_id  
    join prof_keywords as KEYW on PROFILE.professional_id = KEYW.professional_id  
    join prof_recent_jobs as ROLES on PROFILE.professional_id=ROLES.professional_id    
    where status in ('LIVE','EDITS')  
    and (  
        match (knowledge_desc) against ('ramble')   
        or match (job_title) against ('ramble')  
        or match (keyword) against ('ramble')  
        or match (professional_statement) against ('ramble')  
        )   
    group by PROFILE.professional_profile_id



+----+-------------+---------+------------+--------+--------------------------------+-----------------+---------+---------------------------+------+----------+---------------------------------+
| id | select_type | table   | partitions | type   | possible_keys                  | key             | key_len | ref                       | rows | filtered | Extra                           |
+----+-------------+---------+------------+--------+--------------------------------+-----------------+---------+---------------------------+------+----------+---------------------------------+
|  1 | SIMPLE      | KNOWS   | NULL       | ALL    | professional_id                | NULL            | NULL    | NULL                      |   43 |   100.00 | Using temporary; Using filesort |
|  1 | SIMPLE      | PROFILE | NULL       | ref    | PRIMARY,professional_statement | professional_id | 4       | xxx.KNOWS.professional_id |    1 |    28.57 | Using where                     |
|  1 | SIMPLE      | ACC     | NULL       | eq_ref | PRIMARY                        | PRIMARY         | 4       | xxx.KNOWS.professional_id |    1 |   100.00 | NULL                            |
|  1 | SIMPLE      | ROLES   | NULL       | ref    | professional_id                | professional_id | 4       | xxx.KNOWS.professional_id |    1 |   100.00 | NULL                            |
|  1 | SIMPLE      | KEYW    | NULL       | ref    | professional_id                | professional_id | 4       | xxx.KNOWS.professional_id |    2 |   100.00 | Using where                     |
+----+-------------+---------+------------+--------+--------------------------------+-----------------+---------+---------------------------+------+----------+---------------------------------+




CREATE TABLE professional_account (
  professional_id int(11) NOT NULL AUTO_INCREMENT,
  email varchar(60) NOT NULL,
  PRIMARY KEY (professional_id),
  KEY email (email)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE professional_profile (
  professional_profile_id int(11) NOT NULL AUTO_INCREMENT,
  professional_id int(11) NOT NULL,
  status enum('BLANK','PART_WAIT','PART_APP','COMP_WAIT','COMP_APP','LIVE','EDITS') DEFAULT NULL,
  professional_statement text,
  PRIMARY KEY (professional_profile_id),
  KEY professional_id (professional_id),
  FULLTEXT KEY professional_statement (professional_statement),
  CONSTRAINT fk_professional_profile_professional_account FOREIGN KEY (professional_id) REFERENCES professional_account (professional_id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE prof_knows_about (
  prof_knows_about_id int(11) NOT NULL AUTO_INCREMENT,
  professional_id int(11) NOT NULL,
  knowledge_desc varchar(100) DEFAULT NULL,
  PRIMARY KEY (prof_knows_about_id),
  KEY professional_id (professional_id),
  FULLTEXT KEY knowledge_desc (knowledge_desc),
  CONSTRAINT fk_prof_knows_about_professional_profile1 FOREIGN KEY (professional_id) REFERENCES professional_profile (professional_id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE prof_keywords (
  prof_keywords_id int(11) NOT NULL AUTO_INCREMENT,
  professional_id int(11) NOT NULL,
  keyword varchar(20) DEFAULT NULL,
  PRIMARY KEY (prof_keywords_id),
  KEY professional_id (professional_id),
  FULLTEXT KEY keyword (keyword),
  CONSTRAINT fk_prof_keywords_professional_profile1 FOREIGN KEY (professional_id) REFERENCES professional_profile (professional_id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE prof_recent_jobs (
  prof_recent_jobs_id int(11) NOT NULL AUTO_INCREMENT,
  professional_id int(11) NOT NULL,
  job_title varchar(100) DEFAULT NULL,
  experience tinyint(2) DEFAULT NULL,
  PRIMARY KEY (prof_recent_jobs_id),
  KEY professional_id (professional_id),
  FULLTEXT KEY job_title (job_title),
  CONSTRAINT fk_prof_recent_jobs_professional_profile1 FOREIGN KEY (professional_id) REFERENCES professional_profile (professional_id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

CREATE TABLE prof_keywords (
  prof_keywords_id int(11) NOT NULL AUTO_INCREMENT,
  professional_id int(11) NOT NULL,
  keyword varchar(20) DEFAULT NULL,
  PRIMARY KEY (prof_keywords_id),
  KEY professional_id (professional_id),
  FULLTEXT KEY keyword (keyword),
  CONSTRAINT fk_prof_keywords_professional_profile1 FOREIGN KEY (professional_id) REFERENCES professional_profile (professional_id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

0 个答案:

没有答案