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?.
11 rows affected
4 rows affected
accountname | sum_amount |
---|---|
ADDICTION AD | 0 |
ADDICTION ADVICE | 111 |
AIR NEW | 0 |
AIR NEW ZEALAND | 1111 |
NO PATTERN HERE | 11 |
accountname | sum_amount |
---|---|
ADDICTION AD | 0 |
ADDICTION ADVICE | 111 |
AIR NEW | 0 |
AIR NEW ZEALAND | 1111 |
NO PATTERN HERE | 11 |
QUERY PLAN |
---|
GroupAggregate (cost=10000007019.23..10000007028.11 rows=200 width=64) |
Group Key: (COALESCE(a1.target, ac.accountname)) |
-> Sort (cost=10000007019.23..10000007021.36 rows=850 width=64) |
Sort Key: (COALESCE(a1.target, ac.accountname)) |
-> Nested Loop Left Join (cost=10000000008.16..10000006977.88 rows=850 width=64) |
-> Seq Scan on account_code ac (cost=10000000000.00..10000000018.50 rows=850 width=64) |
-> Limit (cost=8.16..8.17 rows=1 width=36) |
-> Sort (cost=8.16..8.17 rows=1 width=36) |
Sort Key: a1.ord_nr |
-> Index Scan using ac_translate_left_idx on ac_translate a1 (cost=0.13..8.15 rows=1 width=36) |
Index Cond: ("left"(ac.accountname, 3) = "left"(like_pattern, 3)) |
Filter: (ac.accountname ~~ like_pattern) |