explain.depesz.com

PostgreSQL's explain analyze made readable

Result: cjFc

Settings
# exclusive inclusive rows x rows loops node
1. 0.005 12,510.846 ↑ 200.0 1 1

GroupAggregate (cost=272,714.75..272,741.68 rows=200 width=40) (actual time=12,510.846..12,510.846 rows=1 loops=1)

  • Group Key: t0."Calculation_1177198784074784770
2. 0.028 12,510.841 ↑ 221.6 15 1

Sort (cost=272,714.75..272,723.06 rows=3,324 width=40) (actual time=12,510.838..12,510.841 rows=15 loops=1)

  • Sort Key: t0."Calculation_1177198784074784770
  • Sort Method: quicksort Memory: 26kB
3. 0.007 12,510.813 ↑ 221.6 15 1

Subquery Scan on t0 (cost=272,354.12..272,520.32 rows=3,324 width=40) (actual time=12,498.569..12,510.813 rows=15 loops=1)

4. 1,795.665 12,510.806 ↑ 221.6 15 1

HashAggregate (cost=272,354.12..272,487.08 rows=3,324 width=40) (actual time=12,498.568..12,510.806 rows=15 loops=1)

  • Group Key: venues.linked_venue_id
  • Filter: (CASE WHEN (date_trunc('DAY'::text, min(users.created_at)) = date_trunc('DAY'::text, (('now'::cstring)::date - '2 days'::interval))) THEN 'Day before Yesterday'::text WHEN (date_trunc('DAY'::text, min(users.created_at)) = date_trunc('DAY'::text, (('now'::cstring)::date - '1 day'::interval))) THEN 'Yesterday'::text ELSE NULL::text END IS NOT NULL)
  • Rows Removed by Filter: 2,965
5. 4,546.953 10,715.141 ↓ 2.1 2,126,545 1

Hash Full Join (cost=16,217.00..259,833.32 rows=1,001,664 width=16) (actual time=624.184..10,715.141 rows=2,126,545 loops=1)

  • Hash Cond: (order_request_items.stock_item_id = stock_items.id)
  • Filter: CASE WHEN ((venues.shop_type)::text = ANY ('{Großhändler,Hersteller,Intern}'::text[])) THEN false ELSE true END
  • Rows Removed by Filter: 46,367
6. 3,136.049 5,853.670 ↑ 1.0 2,000,775 1

Hash Right Join (cost=6,451.99..186,875.05 rows=2,003,329 width=31) (actual time=302.927..5,853.670 rows=2,000,775 loops=1)

  • Hash Cond: (order_request_items.order_request_id = order_requests.id)
7. 2,415.240 2,415.240 ↑ 1.0 1,998,634 1

Seq Scan on order_request_items (cost=0.00..132,748.29 rows=2,003,329 width=16) (actual time=0.033..2,415.240 rows=1,998,634 loops=1)

8. 80.912 302.381 ↓ 1.0 86,468 1

Hash (cost=4,854.70..4,854.70 rows=82,583 width=31) (actual time=302.381..302.381 rows=86,468 loops=1)

  • Buckets: 65,536 Batches: 2 Memory Usage: 3,317kB
9. 127.294 221.469 ↓ 1.0 86,468 1

Hash Right Join (cost=523.35..4,854.70 rows=82,583 width=31) (actual time=26.302..221.469 rows=86,468 loops=1)

  • Hash Cond: (order_requests.venue_id = venues.id)
10. 67.927 67.927 ↓ 1.0 84,449 1

Seq Scan on order_requests (cost=0.00..3,195.83 rows=82,583 width=16) (actual time=0.016..67.927 rows=84,449 loops=1)

11. 0.944 26.248 ↓ 1.0 4,053 1

Hash (cost=472.82..472.82 rows=4,043 width=31) (actual time=26.248..26.248 rows=4,053 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 294kB
12. 3.534 25.304 ↓ 1.0 4,053 1

Hash Join (cost=262.80..472.82 rows=4,043 width=31) (actual time=8.079..25.304 rows=4,053 loops=1)

  • Hash Cond: (venues.user_id = users.id)
13. 13.750 13.750 ↓ 1.0 4,053 1

Seq Scan on venues (cost=0.00..154.43 rows=4,043 width=31) (actual time=0.016..13.750 rows=4,053 loops=1)

14. 0.575 8.020 ↑ 1.0 3,502 1

Hash (cost=219.02..219.02 rows=3,502 width=16) (actual time=8.020..8.020 rows=3,502 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 197kB
15. 7.445 7.445 ↑ 1.0 3,502 1

Seq Scan on users (cost=0.00..219.02 rows=3,502 width=16) (actual time=0.011..7.445 rows=3,502 loops=1)

16. 131.538 314.518 ↓ 1.0 191,642 1

Hash (cost=6,636.56..6,636.56 rows=190,676 width=8) (actual time=314.518..314.518 rows=191,642 loops=1)

  • Buckets: 131,072 Batches: 4 Memory Usage: 2,910kB
17. 182.980 182.980 ↓ 1.0 191,642 1

Index Only Scan using stock_items_pkey on stock_items (cost=0.42..6,636.56 rows=190,676 width=8) (actual time=0.081..182.980 rows=191,642 loops=1)

  • Heap Fetches: 44,280
Planning time : 4.409 ms
Execution time : 12,511.101 ms