SELECT tables.table_schema, tables.table_name, tables.table_rows
FROM information_schema.tables
LEFT JOIN (
SELECT table_schema, table_name
FROM information_schema.statistics
GROUP BY table_schema, table_name, index_name
HAVING
SUM(
CASE WHEN non_unique = 0 AND nullable != 'YES' THEN 1 ELSE 0 END
) = COUNT(*)
) puks
ON tables.table_schema = puks.table_schema AND tables.table_name = puks.table_name
WHERE puks.table_name IS NULL
AND tables.table_schema NOT IN ('mysql', 'information_schema', 'performance_schema', 'sys')
AND tables.table_type = 'BASE TABLE' AND engine='InnoDB';

mysql> SET GLOBAL slave_rows_search_algorithms = 'INDEX_SCAN,HASH_SCAN';

https://dev.mysql.com/doc/refman/5.7/en/replication-options-slave.html#option_mysqld_slave-rows-search-algorithms

The query below helps you to locate tables without a primary key:的更多相关文章

  1. symfony2已有数据表导入实体时报错 Doctrine does not support reverse engineering from tables that don't have a primary key

    先在配置文件 app/config/config.yml中配置 schema_filter: /^(?!(tablename))/ 即可,或者在出现问题表都加上一个id 然后再使用命令 php app ...

  2. InnoDB On-Disk Structures(一)-- Tables (转载)

    转载.节选于https://dev.mysql.com/doc/refman/8.0/en/innodb-tables.html 1.InnoDB Architecture The following ...

  3. MYSQL PERFORMANCE_SCHEMA HINTS

    ACCOUNTS NOT PROPERLY CLOSING CONNECTIONS [ 1 ] Works since 5.6 SELECT ess.user, ess.host , (a.total ...

  4. 13.1.17 CREATE TABLE Syntax

    13.1.17 CREATE TABLE Syntax 13.1.17.1 CREATE TABLE ... LIKE Syntax 13.1.17.2 CREATE TABLE ... SELECT ...

  5. MySQL 5.6 Reference Manual-14.6 InnoDB Table Management

    14.6 InnoDB Table Management 14.6.1 Creating InnoDB Tables 14.6.2 Moving or Copying InnoDB Tables to ...

  6. MySQL/MariaDB数据库的服务器配置

    MySQL/MariaDB数据库的服务器配置 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.MySQL中的系统数据库 1>.mysql数据库 是mysql的核心数据库,类 ...

  7. ocp 1Z0-047 131-276题解析

    131. Which view would you use to display the column names and DEFAULT valuesfor a table?A. DBA_TABLE ...

  8. ocp 1Z0-047 1-60题解析

    1. You need to load information about new customers from the NEW_CUST table into the tables CUST and ...

  9. SQL基础笔记

    Codecademy中Learn SQL, SQL: Table Transformaton和SQL: Analyzing Business Metrics三门课程的笔记,以及补充的附加笔记. Cod ...

随机推荐

  1. 深入理解Plasma(一)Plasma 框架

    这一系列文章将围绕以太坊的二层扩容框架,介绍其基本运行原理,具体操作细节,安全性讨论以及未来研究方向等.本篇文章作为开篇,主要目的是理解 Plasma 框架. Plasma 作为以太坊的二层扩容框架, ...

  2. Python — 字典dict 和 集合set

    字典dict : dict和set的key都是不可变对象 对于不变对象来说,调用对象自身的任意方法,也不会改变对象自身的内容.相反,这些方法会创建新的对象并返回,这样,就保证了不可变对象本身永远是不可 ...

  3. ZZW原创_rsync同步时由于注释问题引起的@ERROR: chdir failed

    1.需求:A机器同步文件到B机器 2.问题: A机器执行如下命令: [root@sv0379 rsync]# rsync -vzrtopg  --password-file=/usr/local/rs ...

  4. hdu多校第3场C. Dynamic Graph Matching

    Problem C. Dynamic Graph Matching Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Tot ...

  5. Python日期的加减等操作

    1. 日期输出格式化 所有日期.时间的api都在datetime模块内. 1. datetime => string now = datetime.datetime.now() now.strf ...

  6. 基于FastJson的通用泛型解决方案

    由于项目使用的是fastjson,也无法换成其他的序列化框架,所以研究了一下他对泛型序列化和反序列化的支持能力,最终解决了这个问题. 要达成的目标 我的封装方式属于通用封装,我要达到的目标是如下的使用 ...

  7. bsxfun.h multiple threads backup

    https://code.google.com/p/deep-learning-faces/source/browse/trunk/cuda_ut/include/bsxfun.h?r=7&s ...

  8. Eclipse中Server视图加载项目之后项目名后边有带括号的名字

    用习惯了eclipse工具,因为某种原因需要修改项目名称.结果选择项目,按“F2”成功修改后,使用tomcat进行web发布时,选择“Add and Remove”,发现名字还是以前那个项目名称.即使 ...

  9. 新浪天气api

    package com.smartdot.dcu; /** * java获取新浪天气预报代码 */ import java.io.FileNotFoundException; import java. ...

  10. JAVA 程序的基本语法

    首先看我们的第一个java程序: public class HelloWorld { public static void main(String[] args) { System.out.print ...