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 TABLE
INSERT 0 700000
DROP FUNCTION
CREATE FUNCTION
QUERY PLAN
Seq Scan on test (cost=0.00..374176.44 rows=700148 width=16) (actual time=0.101..3753.692 rows=700000 loops=1)
  SubPlan 1
    -> Function Scan on get_items rec (cost=0.25..0.26 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=700000)
  SubPlan 2
    -> Function Scan on get_items rec_1 (cost=0.25..0.26 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=700000)
Planning Time: 0.132 ms
Execution Time: 3791.585 ms
EXPLAIN
QUERY PLAN
Nested Loop (cost=0.25..24098.25 rows=700000 width=8) (actual time=0.028..1820.122 rows=700000 loops=1)
  -> Seq Scan on test (cost=0.00..10098.00 rows=700000 width=8) (actual time=0.010..80.999 rows=700000 loops=1)
  -> Function Scan on get_items rec (cost=0.25..0.26 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=700000)
Planning Time: 0.366 ms
Execution Time: 1859.746 ms
EXPLAIN
DROP FUNCTION
CREATE TYPE
CREATE FUNCTION
QUERY PLAN
Seq Scan on test (cost=0.00..360098.00 rows=700000 width=16) (actual time=0.080..1045.486 rows=700000 loops=1)
Planning Time: 0.054 ms
Execution Time: 1078.120 ms
EXPLAIN
DROP FUNCTION
CREATE FUNCTION
QUERY PLAN
Seq Scan on test (cost=0.00..10098.00 rows=700000 width=16) (actual time=0.009..79.016 rows=700000 loops=1)
Planning Time: 0.082 ms
Execution Time: 109.624 ms
EXPLAIN