1. 程式人生 > >Mysql 查詢所有表的行數和大小

Mysql 查詢所有表的行數和大小

SELECT TABLE_NAME,TABLE_ROWS,DATA_LENGTH/1024/1024 "DATA_LENGTH",CREATE_TIME,TABLE_COLLATION FROM

 INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'lir' ORDER BY TABLE_ROWS DESC


  1. [[email protected] ~]$ mysql -u root -p    
  2. Enter password:   
  3. Welcome to the MySQL monitor.  Commands end with ; or \g.  
  4. Your MySQL connection id is 36  
  5. Server version: 5.6.16 MySQL Community Server (GPL)  
  6. Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.  
  7. Oracle is a registered trademark of Oracle Corporation and/or its  
  8. affiliates. Other names may be trademarks of their respective  
  9. owners.  
  10. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.  
  11. mysql> show database;  
  12. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1  
  13. mysql> show databases;  
  14. +--------------------+  
  15. | Database           |  
  16. +--------------------+  
  17. | information_schema |  
  18. | fire               |  
  19. | hive               |  
  20. | lir                |  
  21. | mysql              |  
  22. | performance_schema |  
  23. | test               |  
  24. +--------------------+  
  25. 7 rows in set (0.03 sec)  
  26. mysql> use fire;  
  27. Reading table information for completion of table and column names  
  28. You can turn off this feature to get a quicker startup with -A  
  29. Database changed  
  30. mysql> load data infile 'aa.txt' into table firewallb;  
  31. ERROR 13 (HY000): Can't get stat of '/var/lib/mysql/fire/aa.txt' (Errcode: 2 - No such file or directory)  
  32. mysql> load data infile '/home/dss/aa.txt' into table firewallb;  
  33. ERROR 13 (HY000): Can't get stat of '/home/dss/aa.txt' (Errcode: 13 - Permission denied)  
  34. mysql> load data infile '/tmp/aa.txt' into table firewallb;  
  35. Query OK, 10 rows affected (0.07 sec)  
  36. Records: 10  Deleted: 0  Skipped: 0  Warnings: 0  
  37. mysql> load data infile '/tmp/fireb.txt' into table firewallb;  
  1. Query OK, 16600931 rows affected (38 min 25.54 sec)  
  2. Records: 16600931  Deleted: 0  Skipped: 0  Warnings: 0  

匯入資料檔案到mysql

mysql匯出資料到檔案

SELECT * INTO OUTFILE '/tmp/bb.csv' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' FROM bb_month;


https://blog.csdn.net/wind520/article/details/38728655

相關推薦

Mysql 查詢所有大小

SELECT TABLE_NAME,TABLE_ROWS,DATA_LENGTH/1024/1024 "DATA_LENGTH",CREATE_TIME,TABLE_COLLATION FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SC

SQL Server查看所有大小占用空間信息

add nvarchar 包含 desc cut ack sed dealloc har 一、查看表名和對應的數據行數select a.name as ‘表名‘,b.rows as ‘表數據行數‘from sysobjects a inner join sysindexe

關於Mysql 查詢所有的實時記錄用於對比2個MySQL 庫的據是否異步

執行 密碼 col fetchone con 網上 mysql密碼 方式 HERE Xu言: 今天,為了研究一個MySQL主從同步開機後報錯 問題,如下圖 故障原因分析: 經過分析,可能是主從服務器開機順序導致。(有待下次斷電再次測試) 主從錯誤提示:日誌讀取錯誤的

Postgresql統計所有的基本資訊(如大小等)

pg_class 目錄 pg_class 記錄表和幾乎所有具有列或者像表的東西。這包括索引(但還要參見 pg_index )、序列、檢視、物化檢視、組合型別和TOAST表。 pg_class 中的一些邏輯標誌被以一種懶惰的方式維護:在正確狀態時它們被保證為真,但

sql server 查詢所有記錄

SELECT a.name, b.rows FROM sysobjects AS a INNER JOIN sysindexes AS b ON a.id = b.id WHERE (a.type

mysql 查詢所有庫中所有 中大概記錄

查詢資料庫中所有表名錶中資料量(不可靠)select table_name,table_rows from information_schema.tables  where table_schema='databasename' order by table_rows des

mysql查詢資料庫的資料

檢視mysql某個資料庫下所有表的資料總條數 use information_schema; select sum(TABLE_ROWS) from tables where TABLE_SCHEMA

Java獲得數據庫查詢結果的列,打印查詢結果

rman execute .get name 數據庫查詢 隨筆 while cti etc Java連接數據庫及簡單操作見我以前的一篇隨筆:http://www.cnblogs.com/meitian/p/5036332.html 一、獲取查詢結果的行數和列數 查詢結果

mysql 查詢所有資料庫中沒有主鍵的

mysql 查詢所有資料庫中沒有主鍵的表: select table_schema,table_name from information_schema.tables where (table_schema,table_name) not in( select distinct t

20181005:python遍歷查詢資料庫所有欄位,使用SQLAlchemy查詢所有

用sqlalchemy模組的方法(網上都是這個方法): from sqlalchemy import Column, String, create_engine from sqlalchemy.ext.declarative import declar

Mysql中的遞迴層次查詢(根據父節點查詢所有的子節點根據子節點查詢所有的父節點)的兩種運用

1、根據子節點查詢所有的父節點 建立getParentList函式 SQL語句如下: delimiter // CREATEFUNCTION `getParentList`(rootId INT) R

實現一個函式,列印乘法口訣,口訣自己指定, 輸入9,輸出9*9口訣,輸入12,輸出12*12的乘法口訣

#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> int main() { int n = 0; printf("請輸入一個數:"); scanf("%d", &n);

Oracle 查詢所有的記錄

場景:程式碼資料統計  方法一: select sum(num_rows) from (select t.table_name,t.num_rows from user_tables t) 方法二:

mysql 查詢使用join on使用子查詢in的比較

有兩個表 promotion_full_reduction base_user_favorite_item 現在要查詢使用者收藏的商品中參加促銷了的商品個數,有兩種寫法,一種是使用in子查詢: SELECT COUNT(1) FROM pr

mysql InnoDB引擎的

引入 之前是有接觸行鎖和表鎖但是由於沒有實際應用過也只是大概瞭解,前兩天就遇到了併發同時對一條記錄進行修改。mysql肯定會讓修改請求排隊,也就是說加了鎖,但是mysql預設加的是表鎖,但是會影響效率,所以我們需要用行鎖。 行鎖和表鎖 表鎖:顧名思義就

sql查詢所有的記錄

CREATE TABLE #temp     (       TableName VARCHAR(255) ,       RowCnt INT     )  EXEC sp_MSforeachtable 'INSERT INTO #temp SELECT ''?'', COUNT(*) FROM ?' 

獲取SQL查詢結果集中的

轉自http://cheneyph.iteye.com/blog/477829 在Java中,獲得ResultSet的總行數的方法有以下幾種。 第一種:利用ResultSet的getRow方法來獲得ResultSet的總行數 Statement stmt = con.cre

用C語言中的函式列印乘法口訣可以任意輸入

#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> void print_table(int line) { int i = 0;