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.097..0.444 rows=1 loops=1) |
Filter: (upper(username) = 'NUMBER42'::text) |
Rows Removed by Filter: 999 |
Planning Time: 0.025 ms |
Execution Time: 0.454 ms |
QUERY PLAN |
---|
Seq Scan on demo (cost=0.00..22.01 rows=5 width=32) (actual time=0.033..0.351 rows=1 loops=1) |
Filter: (upper(username) = 'NUMBER42'::text) |
Rows Removed by Filter: 999 |
Planning Time: 0.024 ms |
Execution Time: 0.361 ms |
QUERY PLAN |
---|
Index Scan using demo_upper on demo (cost=0.28..20.38 rows=5 width=32) (actual time=0.043..0.045 rows=1 loops=1) |
Index Cond: (upper(username) = 'NUMBER42'::text) |
Planning Time: 0.272 ms |
Execution Time: 0.067 ms |
QUERY PLAN |
---|
Index Only Scan using demo_upper_covering on demo (cost=0.28..4.38 rows=5 width=32) (actual time=0.044..0.046 rows=1 loops=1) |
Index Cond: ((upper(username)) = 'NUMBER42'::text) |
Heap Fetches: 0 |
Planning Time: 0.206 ms |
Execution Time: 0.066 ms |
QUERY PLAN |
---|
Index Only Scan using demo_upper_stored on demo (cost=0.28..4.36 rows=5 width=32) (actual time=0.046..0.047 rows=1 loops=1) |
Index Cond: (upper_username = 'NUMBER42'::text) |
Heap Fetches: 0 |
Planning Time: 0.123 ms |
Execution Time: 0.066 ms |