关于postgresQL里的GiST索引

 默认的PostgresQL是支持全文检索的,不过是针对英文的,而中文是不行的。网上已经有很多如何使用这种方式,这里就不细所说了。
GiST就是通用搜索树。

谈谈一个初步的体验

数据源是text类型或者varchar类型,索引是tsvector类型。

然后采用是独立索引表或者增加索引字段方式,不管哪种方式,都需要创建触发器。

对于大批量的数据入库的话,可能对写操作速度有些影响

索引表(独立的方式)记录如图:

 

这个东东算是一个检索的基本入门吧。

另外一种是GIN,叫通用倒排索引,是一个存储对(key,posting list)集合的索引结构,Key是一个键值,而posting list是一组出现过”key“的位置。
据说在全文检索时,采用这种方式比GIST更好,参考内容:
GIN index lookups are about three times faster than GiST.
GIN indexes take about three times longer to build than GiST.
GIN indexes are about ten times slower to update than GiST.
GIN indexes are two-to-three times larger than GiST.

后面是会对GIN的使用再谈下感受。

转载自:https://blog.csdn.net/chenyi8888/article/details/6974261

You may also like...