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?.
version |
---|
PostgreSQL 11.9 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5), 64-bit |
QUERY PLAN |
---|
GroupAggregate (cost=16.18..16.21 rows=1 width=586) (actual time=0.034..0.035 rows=0 loops=1) |
Group Key: (COALESCE(itm.serialnumber, ''::character varying)), (COALESCE(itm.item_sku, ''::character varying)), (COALESCE(itm.receivingplant, ''::character varying)), (COALESCE(itm.sto_id, ''::character varying)), hed.supplyingplant, (COALESCE(itm.deliveryitem, ''::character varying)) |
Buffers: shared hit=1 |
-> Sort (cost=16.18..16.18 rows=1 width=586) (actual time=0.033..0.034 rows=0 loops=1) |
Sort Key: (COALESCE(itm.serialnumber, ''::character varying)), (COALESCE(itm.item_sku, ''::character varying)), (COALESCE(itm.receivingplant, ''::character varying)), (COALESCE(itm.sto_id, ''::character varying)), hed.supplyingplant, (COALESCE(itm.deliveryitem, ''::character varying)) |
Sort Method: quicksort Memory: 25kB |
Buffers: shared hit=1 |
-> Nested Loop (cost=0.12..16.17 rows=1 width=586) (actual time=0.014..0.014 rows=0 loops=1) |
Buffers: shared hit=1 |
-> Index Only Scan using transfer_order_header_eventid_supplyingplant_eventtime_idx on transfer_order_header hed (cost=0.12..8.14 rows=1 width=844) (actual time=0.013..0.013 rows=0 loops=1) |
Heap Fetches: 0 |
Buffers: shared hit=1 |
-> Index Scan using transfer_order_item_eventid_idx on transfer_order_item itm (cost=0.00..8.02 rows=1 width=2508) (never executed) |
Index Cond: ((eventid)::text = (hed.eventid)::text) |
Planning Time: 0.698 ms |
Execution Time: 0.165 ms |