美文网首页
数据库 jsonb字段gin索引对比GiST索引

数据库 jsonb字段gin索引对比GiST索引

作者: ifree321 | 来源:发表于2019-09-29 21:12 被阅读0次

原文: https://www.postgresql.org/docs/9.4/textsearch-indexes.html

  • GIN index lookups are about three times faster than GiST

  • GIN indexes take about three times longer to build than GiST

  • GIN indexes are moderately slower to update than GiST indexes, but about 10 times slower if fast-update support was disabled (see Section 58.4.1 for details)

  • GIN indexes are two-to-three times larger than GiST indexes

As a rule of thumb, GIN indexes are best for static data because lookups are faster. For dynamic data, GiST indexes are faster to update. Specifically, GiST indexes are very good for dynamic data and fast if the number of unique words (lexemes) is under 100,000, while GIN indexes will handle 100,000+ lexemes better but are slower to update.

Note that GIN index build time can often be improved by increasing (https://www.postgresql.org/docs/9.4/runtime-config-resource.html#GUC-MAINTENANCE-WORK-MEM), while GiST index build time is not sensitive to that parameter.

Partitioning of big collections and the proper use of GiST and GIN indexes allows the implementation of very fast searches with online update. Partitioning can be done at the database level using table inheritance, or by distributing documents over servers and collecting search results using the dblink module. The latter is possible because ranking functions use only local information.


相关文章

  • 数据库 jsonb字段gin索引对比GiST索引

    原文: https://www.postgresql.org/docs/9.4/textsearch-indexe...

  • postgreSQL 索引(二)类型介绍

    pg的索引有如下几类:B-tree, Hash, GiST, SP-GiST,GIN, BRIN.每个索引都使用不...

  • (一)Elasticsearch 索引

    es索引与mysql数据库对比 1. 索引数据类型 text 文本类型,text类型如果不显示指定映射的字段属性,...

  • MySQL索引建立规则及优化

    概述     相信搭建都知道数据库的常见优化方式,就是建立索引;但是何时建立索引、那些字段需要建立索引,索引是否生...

  • Elasticsearch 索引

    索引 ElasticSearch是文档型数据库,索引(Index)定义了文档的逻辑存储和字段类型,每个索引可以包含...

  • MySQL实战 | 11 怎么给字符串字段加索引?

    两种: 全字段索引 前缀索引 举例: 可以对 email 字段创建全字段索引,或者前缀索引。 区别 1、全字段索引...

  • MongoDB索引

    1. 单字段索引 对普通字段创建索引 对内嵌的文档字段创建索引 2. 复合索引 复合索引的字段顺序、字段的升降序对...

  • 千万级别数据量复杂多表Web程序性能优化

    1.数据库方面的优化 (1)数据库表字段缩减到最合适大小 (2)创建索引!创建索引!创建索引! (3)对不涉及事务...

  • 索引

    索引 哪些字段适合做索引: 外键,主键,where中的字段,连接字段。 索引失效: 1.索引字段like'%xxx...

  • mysql(普通索引-单列索引)

    普通索引命名规则 一般性索引用ind_开头,后面跟字段名 demo sql 创建表之前索引(对比demo sql)...

网友评论

      本文标题:数据库 jsonb字段gin索引对比GiST索引

      本文链接:https://www.haomeiwen.com/subject/zlpoectx.html