【问题标题】:How to query an existing index's type in postgres ?如何在 postgres 中查询现有索引的类型?
【发布时间】:2016-11-14 19:00:35
【问题描述】:

pg_index 表提供有关索引的信息,它似乎没有描述索引类型(btree hash、gin 等)的列

了解现有索引类型的正确方法是什么?

【问题讨论】:

    标签: postgresql


    【解决方案1】:

    索引的访问方法定义在目录pg_am中,由目录pg_class的列relam指向,例如:

    select c.relname, a.amname
    from pg_index i
    join pg_class c on c.oid = i.indexrelid
    join pg_am a on a.oid = c.relam
    where relnamespace = 2200
    
           relname        | amname 
    ----------------------+--------
     array_test_arr_idx   | gin
     students_topics_pkey | btree
     images_pkey          | btree
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-09-12
      • 2023-03-03
      • 1970-01-01
      • 2016-03-12
      • 2011-10-02
      • 2016-12-16
      • 1970-01-01
      相关资源
      最近更新 更多