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?.
1000 rows affected
5000 rows affected
QUERY PLAN
HashAggregate (cost=133.40..137.95 rows=364 width=68) (actual time=1.721..1.900 rows=479 loops=1)
  Group Key: s.sid
  Batches: 1 Memory Usage: 297kB
  -> Hash Join (cost=38.58..130.67 rows=364 width=100) (actual time=0.309..1.226 rows=647 loops=1)
        Hash Cond: (p.sid = s.sid)
        -> Seq Scan on p (cost=0.00..91.14 rows=364 width=68) (actual time=0.018..0.735 rows=647 loops=1)
              Filter: ((jahr1 <= 2004) AND (jahr2 >= 2004))
              Rows Removed by Filter: 4353
        -> Hash (cost=22.70..22.70 rows=1270 width=36) (actual time=0.282..0.282 rows=1000 loops=1)
              Buckets: 2048 Batches: 1 Memory Usage: 67kB
              -> Seq Scan on s (cost=0.00..22.70 rows=1270 width=36) (actual time=0.012..0.154 rows=1000 loops=1)
Planning Time: 0.551 ms
Execution Time: 2.018 ms
QUERY PLAN
HashAggregate (cost=133.40..137.95 rows=364 width=68) (actual time=1.413..1.590 rows=479 loops=1)
  Group Key: s.sid
  Batches: 1 Memory Usage: 297kB
  -> Hash Join (cost=38.58..130.67 rows=364 width=100) (actual time=0.233..0.964 rows=647 loops=1)
        Hash Cond: (p.sid = s.sid)
        -> Seq Scan on p (cost=0.00..91.14 rows=364 width=68) (actual time=0.013..0.540 rows=647 loops=1)
              Filter: ((jahr1 <= 2004) AND (jahr2 >= 2004))
              Rows Removed by Filter: 4353
        -> Hash (cost=22.70..22.70 rows=1270 width=36) (actual time=0.213..0.213 rows=1000 loops=1)
              Buckets: 2048 Batches: 1 Memory Usage: 67kB
              -> Seq Scan on s (cost=0.00..22.70 rows=1270 width=36) (actual time=0.008..0.090 rows=1000 loops=1)
Planning Time: 0.218 ms
Execution Time: 1.641 ms