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?.
2000000 rows affected
QUERY PLAN
Limit (cost=8.46..8.46 rows=1 width=4) (actual time=0.031..0.032 rows=0 loops=1)
  -> Sort (cost=8.46..8.46 rows=1 width=4) (actual time=0.025..0.025 rows=0 loops=1)
        Sort Key: order_id
        Sort Method: quicksort Memory: 25kB
        -> Index Only Scan using orders_test_shipping_date_order_id_idx on orders_test (cost=0.43..8.45 rows=1 width=4) (actual time=0.017..0.018 rows=0 loops=1)
              Index Cond: ((shipping_date >= '2022-05-01'::date) AND (shipping_date <= '2022-05-01'::date))
              Heap Fetches: 0
Planning Time: 66.309 ms
Execution Time: 0.092 ms
100000 rows affected
QUERY PLAN
Limit (cost=0.43..37.05 rows=50 width=4) (actual time=1186.565..1186.593 rows=50 loops=1)
  -> Index Scan using orders_test_pkey on orders_test (cost=0.43..74336.43 rows=101502 width=4) (actual time=1186.562..1186.584 rows=50 loops=1)
        Filter: ((shipping_date >= '2022-05-01'::date) AND (shipping_date <= '2022-05-01'::date))
        Rows Removed by Filter: 2000000
Planning Time: 0.505 ms
Execution Time: 1186.636 ms