select的sql是什么样子的?gbase 8a的基础优化有
1. 使用(5,5)压缩
2. 选择join字段、group by字段作为hash分布列,同时该字段还需count(distinct)较大,便于均匀的分布到所有节点;
3.等值查询,同时distinct值较多时,可以使用hash index索引
4.where条件、jion条件等,最好不带有函数
5.表经过排序也能提升性能
....
1. 使用(5,5)压缩
2. 选择join字段、group by字段作为hash分布列,同时该字段还需count(distinct)较大,便于均匀的分布到所有节点;
3.等值查询,同时distinct值较多时,可以使用hash index索引
4.where条件、jion条件等,最好不带有函数
5.表经过排序也能提升性能
....
SQL模式:select c1,c2...cN from table_name where cX1 = '' and cX2 >= 日期 and cX2 <= 日期
问题:select 语句中添加 /*+ first_rows(number) */ 什么作用
问题:select 语句中添加 /*+ first_rows(number) */ 什么作用
灵魂之躯 发表于 2020-5-8 11:20
SQL模式:select c1,c2...cN from table_name where cX1 = '' and cX2 >= 日期 and cX2
first_rows是hint优化的一种,用于设置每次最小的返回结果集。
灵魂之躯 发表于 2020-5-8 11:20
SQL模式:select c1,c2...cN from table_name where cX1 = '' and cX2 >= 日期 and cX2
使用hint first_rows主要是将集群的hint发到node上去,也就是说在发给node的语句上保留集群的first_rows这个hint。
使用约束:
登录集群时使用-c和-q参数
-c参数的作用,让hint,也就是/*+ … */不会直接被客户端忽略,会发送到server端。
-q参数,保证在集群的节点上使hint可以起作用。
只能对于单表查询时,并且使用了limit关键字,并且limit不能包含offset时,才能有优化作用。
查询语句中不能包含GROUP BY、ORDERBY、OLAP函数,不支持UNION,但支持UNION ALL。
语法格式:
SEELCT /*+ first_rows(n1) */ colums FROM table_nameLIMIT n;
其中,n1表示每次最小的返回结果集的请求。