By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
CREATE INDEX
INSERT 0 100000
| QUERY PLAN |
|---|
| Bitmap Heap Scan on test (cost=12.18..482.70 rows=501 width=4) (actual time=0.028..0.048 rows=12 loops=1) |
| Recheck Cond: (a = 100) |
| Heap Blocks: exact=12 |
| -> Bitmap Index Scan on test_a_b_idx (cost=0.00..12.05 rows=501 width=0) (actual time=0.017..0.018 rows=12 loops=1) |
| Index Cond: (a = 100) |
| Planning Time: 0.291 ms |
| Execution Time: 0.093 ms |
EXPLAIN
| QUERY PLAN |
|---|
| Seq Scan on test (cost=0.00..1694.48 rows=501 width=4) (actual time=2.138..17.018 rows=6 loops=1) |
| Filter: (b = 100) |
| Rows Removed by Filter: 99994 |
| Planning Time: 0.045 ms |
| Execution Time: 17.036 ms |
EXPLAIN
| QUERY PLAN |
|---|
| Seq Scan on test (cost=0.00..1694.48 rows=501 width=4) (actual time=1.785..13.282 rows=6 loops=1) |
| Filter: (b = 100) |
| Rows Removed by Filter: 99994 |
| Planning Time: 0.063 ms |
| Execution Time: 13.301 ms |
EXPLAIN
| seq_page_cost |
|---|
| 1 |
SHOW
| random_page_cost |
|---|
| 4 |
SHOW
SET
SET
| QUERY PLAN |
|---|
| Index Only Scan using test_a_b_idx on test (cost=0.29..1411.19 rows=501 width=4) (actual time=0.191..3.591 rows=6 loops=1) |
| Index Cond: (b = 100) |
| Heap Fetches: 6 |
| Planning Time: 0.132 ms |
| Execution Time: 3.614 ms |
EXPLAIN
| QUERY PLAN |
|---|
| Index Only Scan using test_a_b_idx on test (cost=0.29..332.06 rows=501 width=4) (actual time=0.013..0.023 rows=12 loops=1) |
| Index Cond: (a = 100) |
| Heap Fetches: 12 |
| Planning Time: 0.053 ms |
| Execution Time: 0.039 ms |
EXPLAIN