查询评估计划不懂postgre

问题描述

一直在关注 YouTube 自定进度学习 Postgresql。禁用索引扫描。 YouTube link

我们应该期望删除 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)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)