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.033..0.042 rows=5 loops=1) |
| Recheck Cond: (a = 100) |
| Heap Blocks: exact=5 |
| -> Bitmap Index Scan on test_a_b_idx (cost=0.00..12.05 rows=501 width=0) (actual time=0.019..0.020 rows=5 loops=1) |
| Index Cond: (a = 100) |
| Planning Time: 0.933 ms |
| Execution Time: 0.102 ms |
EXPLAIN
| QUERY PLAN |
|---|
| Seq Scan on test (cost=0.00..1694.48 rows=501 width=4) (actual time=0.682..18.101 rows=8 loops=1) |
| Filter: (b = 100) |
| Rows Removed by Filter: 99992 |
| Planning Time: 0.043 ms |
| Execution Time: 18.119 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..332.06 rows=501 width=4) (actual time=0.083..0.089 rows=5 loops=1) |
| Index Cond: (a = 100) |
| Heap Fetches: 5 |
| Planning Time: 0.070 ms |
| Execution Time: 0.120 ms |
EXPLAIN
| QUERY PLAN |
|---|
| Index Only Scan using test_a_b_idx on test (cost=0.29..1400.19 rows=501 width=4) (actual time=1.133..4.010 rows=8 loops=1) |
| Index Cond: (b = 100) |
| Heap Fetches: 8 |
| Planning Time: 0.044 ms |
| Execution Time: 4.027 ms |
EXPLAIN