postgresql 文本索引 spgist 与 btree 区别

postgresql 对文本的索引有 spgist 和 btree 两种,同样一张表,行数 140w 行左右,建立 btree 索引,执行一次 like starts with,冷启动大约 1.4s,反复多跑一次,稳定在 1.1s

改成 spgist 索引呢,瞬间降到 0.03s,到底是什么黑科技,能这么明显的提速

搜了一下,看到这里 http://www.postgres.cn/docs/9…. 大概是类似前缀索引和查找的套路

Leave a Reply

Your email address will not be published. Required fields are marked *