首页 > 解决方案 > 查询评估计划不理解 postgre

问题描述

一直在关注 YouTube 自学 PostgreSQL。禁用索引扫描。YouTube链接

我们应该期望删除 999,999 行,只剩下 1 行。但是查询计划是Rows Removed by Filter: 333333 这 333333 行删除是什么意思?

我有根据的猜测是,这只是指一位特定的工人。

 demo=# explain (verbose, analyze) select count(*)  from indexed as i where i.a =42;
                                                                 QUERY PLAN
    
    -------------------------------------------------------------------------------------------------------------------------------------
     Aggregate  (cost=15554.44..15554.45 rows=1 width=8) (actual time=90.376..107.817 rows=1 loops=1)
       Output: count(*)
       ->  Gather  (cost=1000.00..15554.43 rows=1 width=0) (actual time=0.544..71.365 rows=1 loops=1)
             Workers Planned: 2
             Workers Launched: 2
             ->  Parallel Seq Scan on public.indexed i  (cost=0.00..14554.33 rows=1 width=0) (actual time=11.970..29.707 rows=0 loops=3)
                   Filter: (i.a = 42)
                   Rows Removed by Filter: 333333
                   Worker 0:  actual time=15.902..15.903 rows=0 loops=1
                   Worker 1:  actual time=19.989..19.989 rows=0 loops=1
     Planning Time: 0.175 ms
     Execution Time: 107.879 ms
    (12 rows)

标签: databasehashtable

解决方案


推荐阅读