前言:统计信息作为sql server优化器生成执行计划的重要参考,需要数据库开发人员,数据库管理员对其有一定的理解,从而合理高效的应用,管理. 第一部分 概念 统计信息(statistics):描述某个(些)栏位,索引的数据分布情况.优化器用其评估生成高效执行计划. 密度(density):一个比率值,显示在一个(组)列中有多少唯一值.(实际应用中值越小越好) Density = 1 / Number of distinct values for column(s) 直方图(histogram…
Hive 表分区 Hive表的分区就是一个目录,分区字段不和表的字段重复 创建分区表: create table tb_partition(id string, name string) PARTITIONED BY (month string) row format delimited fields terminated by '\t'; 加载数据到hive分区表中 方法一:通过load方式加载 load data local inpath '/home/hadoop/files/namein…
overview Oracle's cost-based optimizer (COB) uses statistics to calculate the selectivity (the fraction of rows in a table that the SQL statement's predicate chooses) of predicates and to estimate the "cost" of each execution plan. The COB will…