Note:这里面是升级到8.0,需要开发人员参与修改部分或注意部分
-
不常用 废弃了 GROUP BY 分组的排序 ASC 和 DESC, 存储过程中包含此语法的无法正常执行;
-
不常用 最新版可能不支持 &&, ||, ! 的语法, 需要使用标准 SQL 的 AND, OR, NOT 进行替换;
-
不常用 外键的名字在整个 schema 中必须唯一;
-
常用 支持公共表表达式cte, 窗口函数
不再支持5.6,5.7 的土方法实现递规这种写法废了!不能再用了
SELECT * FROM(SELECT @rn:= CASE WHEN @id = id THEN @rn + 1 ELSE 1 END AS rownum,@id:= id as id, volume, dateFROM(SELECT * from table_001 WHERE fdate <= '2022-02-16' ORDER BY id, date DESC) a ,(SELECT @rn=0, @id=0) b )aWHERE rownum <= 5
-
不常用 支持备份锁(backup lock)
-
常用 使用 select xxx into outfile xx from xxx 语法导出数据, select xx from xxx into outfile .. 语法可能废弃;
-
DBA常用 使用 set password for … = '' 修改用户密码, password(..) 语法已经废弃;
-
不常用 不支持 SELECT SQL_NO_CACHE … 语法;
-
DBA常用 sqllogbin 仅支持会话级别的设置;
-
常用 使用 EXPLAIN 时, 不支持于 EXTENDED 和 PARTITIONS 关键字一起使用;
-
DBA索引调优常用 索引增加 invisible index(隐藏索引), 一个索引被设置为 invisible 后, 优化器会忽略该索引. 适合性能调试;
-
索引常用 索引支持 descending index(降序索引);
-
索引常用索引支持 functional index(函数索引)
-
索引常用索引索引命中优化, 更多见 optimizer hints;
-
建表语句没有整形宽度
id int(11) NOT NULL
变成id int NOT NULL
-
8.0新增131个关键字
ACTIVE,ADMIN,ARRAY,ATTRIBUTE,AUTHENTICATION,BUCKETS,CHALLENGE_RESPONSE,CLONE,COMPONENT,CUME_DIST,DEFINITION,DENSE_RANK,DESCRIPTION,EMPTY,ENFORCED,ENGINE_ATTRIBUTE,EXCEPT,EXCLUDE,FACTOR,FAILED_LOGIN_ATTEMPTS,FINISH,FIRST_VALUE,FOLLOWING,GEOMCOLLECTION,GET_MASTER_PUBLIC_KEY,GET_SOURCE_PUBLIC_KEY,GROUPING,GROUPS,GTID_ONLY,HISTOGRAM,HISTORY,INACTIVE,INITIAL,INITIATE,INVISIBLE,JSON_TABLE,JSON_VALUE,KEYRING,LAG,LAST_VALUE,LATERAL,LEAD,LOCKED,MASTER_COMPRESSION_ALGORITHMS,MASTER_PUBLIC_KEY_PATH,MASTER_TLS_CIPHERSUITES,MASTER_ZSTD_COMPRESSION_LEVEL,MEMBER,NESTED,NETWORK_NAMESPACE,NOWAIT,NTH_VALUE,NTILE,NULLS,OF,OFF,OJ,OLD,OPTIONAL,ORDINALITY,ORGANIZATION,OTHERS,OVER,PASSWORD_LOCK_TIME,PATH,PERCENT_RANK,PERSIST,PERSIST_ONLY,PRECEDING,PRIVILEGE_CHECKS_USER,PROCESS,RANDOM,RANK,RECURSIVE,REFERENCE,REGISTRATION,REPLICA,REPLICAS,REQUIRE_ROW_FORMAT,RESOURCE,RESPECT,RESTART,RETAIN,RETURNING,REUSE,ROLE,ROW_NUMBER,SECONDARY,SECONDARY_ENGINE,SECONDARY_ENGINE_ATTRIBUTE,SECONDARY_LOAD,SECONDARY_UNLOAD,SKIP,SOURCE_AUTO_POSITION,SOURCE_BIND,SOURCE_COMPRESSION_ALGORITHMS,SOURCE_CONNECT_RETRY,SOURCE_DELAY,SOURCE_HEARTBEAT_PERIOD,SOURCE_HOST,SOURCE_LOG_FILE,SOURCE_LOG_POS,SOURCE_PASSWORD,SOURCE_PORT,SOURCE_PUBLIC_KEY_PATH,SOURCE_RETRY_COUNT,SOURCE_SSL,SOURCE_SSL_CA,SOURCE_SSL_CAPATH,SOURCE_SSL_CERT,SOURCE_SSL_CIPHER,SOURCE_SSL_CRL,SOURCE_SSL_CRLPATH,SOURCE_SSL_KEY,SOURCE_SSL_VERIFY_SERVER_CERT,SOURCE_TLS_CIPHERSUITES,SOURCE_TLS_VERSION,SOURCE_USER,SOURCE_ZSTD_COMPRESSION_LEVEL,SRID,STREAM,SYSTEM,THREAD_PRIORITY,TIES,TLS,UNBOUNDED,UNREGISTER,VCPU,VISIBLE,WINDOW,ZONE
减少 6个关键字ANALYSE,DES_KEY_FILE,MASTER_SERVER_ID,PARSE_GCOL_EXPR,REDOFILE,SQL_CACHE
对业务有影响的关键字有: ‘CUME_DIST’,‘DENSE_RANK’,‘EMPTY’,‘EXCEPT’,‘FIRST_VALUE’,‘GROUPING’,‘GROUPS’,‘JSON_TABLE’,‘LAG’,‘LAST_VALUE’,‘LATERAL’,‘LEAD’,‘NTH_VALUE’,‘NTILE’,‘OF’,‘OVER’,‘PERCENT_RANK’,‘RANK’,‘RECURSIVE’,‘ROW_NUMBER’,‘SYSTEM’,‘WINDOW’
附: 我们查表/字段是否用到8.0关键字的SQL
select c.linkname,c.dbver,b.dbname,a.table_name,a.COLUMN_NAME from info_columns a
join linkdb b on a.dbid=b.dbid
join linkset c on b.linkname=c.linkname
where length(IS_NULLABLE)>1 and
(
table_name in ('CUME_DIST','DENSE_RANK','EMPTY','EXCEPT','FIRST_VALUE','GROUPING','GROUPS','JSON_TABLE','LAG','LAST_VALUE','LATERAL','LEAD','NTH_VALUE','NTILE','OF','OVER','PERCENT_RANK','RANK','RECURSIVE','ROW_NUMBER','SYSTEM','WINDOW')
or
COLUMN_NAME in ('CUME_DIST','DENSE_RANK','EMPTY','EXCEPT','FIRST_VALUE','GROUPING','GROUPS','JSON_TABLE','LAG','LAST_VALUE','LATERAL','LEAD','NTH_VALUE','NTILE','OF','OVER','PERCENT_RANK','RANK','RECURSIVE','ROW_NUMBER','SYSTEM','WINDOW')
)
and c.appuse=9
and c.dbver not like '8%'
>> Home