add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
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 FUNCTION
CREATE TABLE
INSERT 0 500000
CREATE INDEX
CREATE INDEX
ANALYZE
SET
QUERY PLAN
Bitmap Heap Scan on public.subscriptions (cost=119.84..5038.43 rows=12367 width=47) (actual time=1.838..77.133 rows=12342 loops=1)
  Output: id, tags
  Recheck Cond: (subscriptions.tags @> '{t1}'::text[])
  Heap Blocks: exact=4424
  -> Bitmap Index Scan on idx_subscriptions_gin (cost=0.00..116.75 rows=12367 width=0) (actual time=1.332..1.332 rows=12342 loops=1)
        Index Cond: (subscriptions.tags @> '{t1}'::text[])
Planning Time: 0.406 ms
Execution Time: 77.931 ms
EXPLAIN
QUERY PLAN
Seq Scan on public.subscriptions (cost=10000000000.00..10000011014.00 rows=487633 width=47) (actual time=0.111..169.869 rows=437395 loops=1)
  Output: id, tags
  Filter: (NOT (subscriptions.tags @> '{t1}'::text[]))
  Rows Removed by Filter: 62605
Planning Time: 0.083 ms
Execution Time: 184.431 ms
EXPLAIN