校正oracle,mysql,hive,postgresql,greenplum 记录数分析命令

oracle:

analyze table TEST_ORACLE_PARTITION compute statistics; 

mysql:

1.从information_schema表中查询相关字段行数等信息

select t.TABLE_NAME as `name`,t.TABLE_ROWS as `rows` 
from information_schema.TABLES as t 
where TABLE_SCHEMA=database()
and t.TABLE_NAME in ('tableName')
union all
select 'tableName',count(1) from tableName;
  1. 用分析命令获取

    Analyze table tableName;

hive:

## 只在HIVE中生效,SparkSQL中不生效 ##     ## 非ORC文件会触发MapReduce任务进行统计

非分区表

ANALYZE TABLE databasename.tablename COMPUTE STATISTICS;

分区表

ANALYZE TABLE databasename.tablename  PARTITION(day='20210825',source=400) COMPUTE STATISTICS;

postgresql&greenplum:

vacuum analyze ff.newtable;
原文地址:https://www.cnblogs.com/txdblog/p/15204812.html