By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
1000 rows affected
id | username |
---|---|
66 | Number42 |
QUERY PLAN |
---|
Seq Scan on demo (cost=0.00..22.00 rows=5 width=40) (actual time=0.162..0.588 rows=1 loops=1) |
Filter: (upper(username) = 'NUMBER42'::text) |
Rows Removed by Filter: 999 |
Planning Time: 0.031 ms |
Execution Time: 0.601 ms |
QUERY PLAN |
---|
Seq Scan on demo (cost=0.00..22.01 rows=5 width=32) (actual time=0.043..0.501 rows=1 loops=1) |
Filter: (upper(username) = 'NUMBER42'::text) |
Rows Removed by Filter: 999 |
Planning Time: 0.031 ms |
Execution Time: 0.513 ms |
QUERY PLAN |
---|
Index Scan using demo_upper on demo (cost=0.28..20.38 rows=5 width=32) (actual time=0.030..0.031 rows=1 loops=1) |
Index Cond: (upper(username) = 'NUMBER42'::text) |
Planning Time: 0.168 ms |
Execution Time: 0.045 ms |
QUERY PLAN |
---|
Index Only Scan using demo_upper_covering on demo (cost=0.28..4.38 rows=5 width=32) (actual time=0.045..0.047 rows=1 loops=1) |
Index Cond: ((upper(username)) = 'NUMBER42'::text) |
Heap Fetches: 0 |
Planning Time: 0.173 ms |
Execution Time: 0.062 ms |
QUERY PLAN |
---|
Index Only Scan using demo_upper_stored on demo (cost=0.28..4.36 rows=5 width=32) (actual time=0.050..0.052 rows=1 loops=1) |
Index Cond: (upper_username = 'NUMBER42'::text) |
Heap Fetches: 0 |
Planning Time: 0.124 ms |
Execution Time: 0.071 ms |