鉴于:
postgres=# create table testing(a int primary key, b int not null);
CREATE TABLE
postgres=# create index on testing (b) where b = 0;
CREATE INDEX
postgres=# \d testing
Table "public.testing"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | not null |
b | integer | | not null |
Indexes:
"testing_pkey" PRIMARY KEY, btree (a)
"testing_b_idx" btree (b) WHERE b = 0
当在!=INSERT
处添加新行时,我是否需要支付更新索引的惩罚?b
0
理想情况下,我想加速值为b
=的查询,而不会增加在!=1
处插入新行的延迟。b
0