【问题标题】:Postgres how do I remove an index on a chilldtable in a partition?Postgres如何删除分区中chilldtable上的索引?
【发布时间】:2020-05-07 23:10:34
【问题描述】:

我想禁用子分区表上的索引。当我尝试时,我得到一个错误。

ERROR: cannot drop index mysema.col_extra_val_355_customer_id_idx because index mysema.col_extra_val_customer_id_idx1 requires it HINT: You can drop index mysema.col_extra_val_customer_id_idx1 instead.

该表是一个巨大的表,分区有 1/2 亿行。插入新数据时,拥有索引会导致插入速度变慢。每次插入都会为一个子分区表聚集。为了提高插入速度,我想删除该表的索引,然后重新安装索引。

删除整个表中的索引将花费太多时间,因为有 1/2 的十亿行。我使用 Postgres 11。

【问题讨论】:

    标签: postgresql database-partitioning


    【解决方案1】:

    您可以分离分区、删除索引、加载到分区、重新创建索引和重新附加分区。

    当然,只有在加载时不需要附加分区时才会有效。

    【讨论】:

    • 谢谢。我刚刚用桌子测试过。从表中分离一个分区。隔板包含 3,2 磨行。花了.153 毫秒。从那里我删除了索引,插入,重新建立索引并在 413 毫秒内重新连接。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-06-03
    • 2016-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-31
    相关资源
    最近更新 更多