没有“有损”的“索引重新检查删除的行”是什么意思?

And*_*eKR 3 postgresql execution-plan explain postgresql-9.6

这是来自 Postgres 9.6 的 EXPLAIN ANALYZE 的一部分:

->  Bitmap Heap Scan on cities  (cost=90.05..806.49 rows=265 width=4) (actual time=4.733..45.772 rows=17 loops=1)
       Recheck Cond: (regexp_replace(regexp_replace(replace(replace(replace(replace(lower(name), 'ä'::text, 'ae'::text), 'ö'::text, 'oe'::text), 'ü'::text, 'ue'::text), 'ß'::text, 'ss'::text), 'strasse\M'::text, 'strasse'::text, 'g'::text), '\W'::text, ''::text, 'g'::text) % 'coerde'::text)
      Rows Removed by Index Recheck: 567
      Heap Blocks: exact=497
      ->  Bitmap Index Scan on city_lookup_index  (cost=0.00..89.98 rows=265 width=0) (actual time=4.229..4.229 rows=584 loops=1)
             Index Cond: (regexp_replace(regexp_replace(replace(replace(replace(replace(lower(name), 'ä'::text, 'ae'::text), 'ö'::text, 'oe'::text), 'ü'::text, 'ue'::text), 'ß'::text, 'ss'::text), 'strasse\M'::text, 'strasse'::text, 'g'::text), '\W'::text, ''::text, 'g'::text) % 'coerde'::text)
Run Code Online (Sandbox Code Playgroud)

什么Rows Removed by Index Recheck意思?

或者换句话说:位图是无损的(只有exact页面),那么为什么它包含(大概)被重新检查删除的元组指针?

jja*_*nes 5

一些索引策略并不能肯定地得出一个元组符合标准的结论。他们可以绝对快速地消除大多数可能不符合标准的元组(这是性能提升的来源),但其中一些通过的元组可能是误报,因此需要重新检查。

我猜你正在使用gin_trgm_ops,这是这种索引策略的一个例子。