hypopg 虚拟索引插件

https://github.com/HypoPG/hypopg

1、安装

wget https://github.com/HypoPG/hypopg/archive/1.1.3.zip
unzip 1.1.3.zip 
cd hypopg-1.1.3/
source /home/postgres/.bashrc
make
make install

2、操作

建立虚拟索引 
SELECT * FROM hypopg_create_index('CREATE INDEX ON hypo (id)');  
查看已建立了哪些虚拟索引
SELECT * FROM hypopg_list_indexes();  
查看建立虚拟索引后的执行计划
EXPLAIN SELECT * FROM hypo WHERE id = 1; 
查看真实的执行计划
EXPLAIN ANALYZE SELECT * FROM hypo WHERE id = 1; 
 
清除虚拟索引
调用hypopg_drop_index(indexrelid) 清除单个虚拟索引,调用hypopg_reset() 清除所有虚拟索引。
select * from hypopg_drop_index(indexrelid);
select * from hypopg_reset();
posted @ 2020-09-22 11:14  lottu  阅读(229)  评论(0)    收藏  举报