【我和openGauss的故事】openGauss价值特性 (二)
索引推荐(Index-Advisor)
Index-Advisor共包含三个子功能,单查询索引推荐,虚拟索引和负载级别索引推荐。
单查询索引推荐
功能支持用户在数据库中直接进行操作,本功能基于查询语句的语义信息和数据库的统计信息,对用户输入的单条查询语句生成推荐的索引。本功能涉及的函数接口如下。
gs_index_advise() 功能:只针对单条的SQL语句
环境如下:
openGauss=# select count(*) from employee;
count
---------
1000000
(1 row)
-----------------------------------------------------------------------------
openGauss=# \d employee;
Table "public.employee"
Column | Type | Modifiers
---------+---------+-----------
empid | integer | not null
empname | text | not null
deptid | integer | not null
salary | integer | not null
Indexes:
"idx_empdepid" btree (deptid) TABLESPACE pg_default
openGauss=# ANALYZE employee;
ANALYZE
下面开始测试:
openGauss=# SELECT * FROM gs_index_advise('select * from employee where empid<1');
schema | table | column | indextype
------