database - 查询评估计划不理解 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)
解决方案
推荐阅读
- kubernetes - Rancher 使用自托管和云提供商?
- laravel-5 - 根据多态关系中的模型类型获取所有记录
- wordpress - 编写插件:插入图片
- filenames - Drupal 8 在实体保存时在私人和公共文件夹之间移动文件
- linux - 使用 Shell 创建具有完整数字格式而不是字符串格式的 CSV 文件
- javascript - document.getElementById("<%= errorIcon.ClientID %>"); 给空
- c++ - c++:原始指针映射中的复制、删除和运算符 =
- android - 如何在kotlin android中将base64字符串转换为图像
- reactjs - 通过 webpack 编译时出现此错误 Unexpected token, expected ","
- sql - 如何仅在 SQLCMD 作业的输出中获得结果?