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?.
CREATE TABLE
INSERT 0 100000
CREATE INDEX
QUERY PLAN |
---|
Bitmap Heap Scan on mytable (actual time=0.416..0.475 rows=2 loops=1) |
Recheck Cond: (to_tsvector('english'::regconfig, (((text_id)::text || ' '::text) || customer_unit_id)) @@ '''k'' & ''-2021'' & ''-8'' | ''176'''::tsquery) |
Heap Blocks: exact=2 |
-> Bitmap Index Scan on trgrm_ts_vec_idx (actual time=0.255..0.255 rows=2 loops=1) |
Index Cond: (to_tsvector('english'::regconfig, (((text_id)::text || ' '::text) || customer_unit_id)) @@ '''k'' & ''-2021'' & ''-8'' | ''176'''::tsquery) |
Planning Time: 11.494 ms |
Execution Time: 0.543 ms |
EXPLAIN
ALTER TABLE
UPDATE 100000
CREATE INDEX
QUERY PLAN |
---|
Bitmap Heap Scan on mytable (actual time=0.185..0.203 rows=2 loops=1) |
Recheck Cond: (ts @@ '''k'' & ''-2021'' & ''-8'' | ''176'''::tsquery) |
Heap Blocks: exact=2 |
-> Bitmap Index Scan on trgrm_ts_vec_idx2 (actual time=0.155..0.155 rows=2 loops=1) |
Index Cond: (ts @@ '''k'' & ''-2021'' & ''-8'' | ''176'''::tsquery) |
Planning Time: 0.352 ms |
Execution Time: 0.231 ms |
EXPLAIN