返回首页

gbase数据、南大通用产品文档:GBase8a

更新日期:2024年09月11日

GBA-01BR-0041
错误码
错误标识
错误显示信息
GBA-01BR-0041

write file failed
错误出现原因
写文件失败
分析与建议
检查文件系统权限,状态

索引使用约束
下面是一个使用索引的例子:
gbase=#create table table1 (c_int int,c_bigint bigint,c_varchar varchar,c_text
text) with(orientation=row);

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
634
gbase=#create text search configuration ts_conf_1(parser=POUND);
gbase=#create text search configuration ts_conf_2(parser=POUND)
with(split_flag='%');
gbase=#set default_text_search_config='ts_conf_1';
gbase=#create index idx1 on table1 using gin(to_tsvector(c_text));
gbase=#set default_text_search_config='ts_conf_2';
gbase=#create index idx2 on table1 using gin(to_tsvector(c_text));
gbase=#select c_varchar,to_tsvector(c_varchar) from table1 where
to_tsvector(c_text) @@ plainto_tsquery('¥#@……&**') and to_tsvector(c_text)
@@ plainto_tsquery('某公司') and c_varchar is not null order by 1 desc limit 3;
该例子的关键点是表table1 的同一个列c_text 上建立了两个gin 索引:idx1 和idx2,但
这两个索引是在不同default_text_search_config 的设置下建立的。
该例子和同一张表的同一
个列上建立普通索引的不同之处在于:

gin 索引使用了不同的parser(即分隔符不同)
,那么idx1 和idx2 的索引数据是不同的;

在同一张表的同一个列上建立的多个普通索引的索引数据是相同的。
因此当执行同一个
查询时,使用idx1 和idx2 查询出的结果是不同的。
使用约束
通过上面的例子,索引使用满足如下条件时:

在同一个表的同一个列上建立了多个gin 索引;

这些gin 索引使用了不同的parser(即分隔符不同)


在查询中使用了该列,且执行计划中使用索引进行扫描;
为了避免使用不同gin 索引导致查询结果不同的问题,
需要保证在物理表的一列上只有
一个gin 索引可用。

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
635

相关命令
gs_preinstall,gs_uninstall