查询MYSQL、Oracle和达梦数据库表数据量

MYSQL

SELECT table_name, table_rows 
FROM information_schema.tables 
WHERE table_schema = 'your_database_name' 
ORDER BY table_rows DESC;

Oracle

SELECT table_name, to_number(extractvalue(xmltype(
    dbms_xmlgen.getxml('select count(*) c from '||table_name))
  ,'/ROWSET/ROW/C')) AS row_count
FROM user_tables
ORDER BY row_count DESC ;

达梦

SELECT B.OWNER,B.TABLE_NAME,TABLE_ROWCOUNT(B.OWNER,B.TABLE_NAME) "TABLE_ROWS"
FROM (SELECT A.OWNER,A.TABLE_NAME FROM ALL_TABLES A WHERE A.TABLE_NAME NOT LIKE 'CTI%' AND A.TABLE_NAME NOT LIKE 'SREF_CON_TAB%' AND A.TABLE_NAME NOT LIKE 'BM%'
) B where B.OWNER='schema_name'
ORDER BY 3 DESC,1,2;

 

posted @ 2024-06-13 17:41  杜子烟  阅读(71)  评论(0编辑  收藏  举报