欢迎来到田晓东的博客

人生三从境界:昨夜西风凋碧树,独上高楼,望尽天涯路。 衣带渐宽终不悔,为伊消得人憔悴。 众里寻他千百度,蓦然回首,那人却在灯火阑珊处。
扩大
缩小

校正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;

posted on 2021-08-30 10:34  匍匐的仰望者  阅读(89)  评论(0编辑  收藏  举报

导航