explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uoJt

Settings
# exclusive inclusive rows x rows loops node
1. 8.665 1,075.370 ↓ 153.2 613 1

Subquery Scan on sub_query (cost=12,720.20..13,941.35 rows=4 width=122) (actual time=74.747..1,075.370 rows=613 loops=1)

2. 1.013 73.645 ↓ 153.2 613 1

Sort (cost=12,720.20..12,720.21 rows=4 width=122) (actual time=72.971..73.645 rows=613 loops=1)

  • Sort Key: at.created_at DESC
  • Sort Method: quicksort Memory: 139kB
3.          

Initplan (forSort)

4. 0.001 0.018 ↑ 1.0 1 1

Limit (cost=0.28..0.37 rows=1 width=4) (actual time=0.017..0.018 rows=1 loops=1)

5. 0.017 0.017 ↑ 412.0 1 1

Index Scan Backward using idx_market_calendars_calendar_date on market_calendars mc (cost=0.28..34.89 rows=412 width=4) (actual time=0.017..0.017 rows=1 loops=1)

  • Index Cond: (calendar_date <= (now())::date)
  • Filter: (NOT is_holiday)
6. 0.325 72.614 ↓ 153.2 613 1

Nested Loop (cost=0.56..12,719.79 rows=4 width=122) (actual time=1.451..72.614 rows=613 loops=1)

7. 69.229 69.229 ↓ 2.2 85 1

Seq Scan on alerts a (cost=0.00..12,234.70 rows=38 width=36) (actual time=0.651..69.229 rows=85 loops=1)

  • Filter: (user_id = 55357)
  • Rows Removed by Filter: 249092
8. 3.060 3.060 ↓ 7.0 7 85

Index Scan using idx_alert_triggers_alert_id_created_at on alert_triggers at (cost=0.56..12.76 rows=1 width=90) (actual time=0.025..0.036 rows=7 loops=85)

  • Index Cond: ((alert_id = a.id) AND (date_trunc('day'::text, created_at) = $1))
  • Filter: (array_length(stock_ids, 1) > 0)
9.          

SubPlan (forSubquery Scan)

10. 1.226 993.060 ↑ 10.0 10 613

Limit (cost=305.02..305.27 rows=100 width=8) (actual time=1.618..1.620 rows=10 loops=613)

11. 12.260 991.834 ↑ 10.0 10 613

Sort (cost=305.02..305.27 rows=100 width=8) (actual time=1.617..1.618 rows=10 loops=613)

  • Sort Key: s.nsecode
  • Sort Method: quicksort Memory: 25kB
12. 429.713 979.574 ↑ 10.0 10 613

Hash Join (cost=2.25..301.70 rows=100 width=8) (actual time=0.420..1.598 rows=10 loops=613)

  • Hash Cond: (s.id = stock_id.stock_id)
13. 544.344 544.344 ↑ 1.0 6,505 613

Seq Scan on stocks s (cost=0.00..274.05 rows=6,505 width=12) (actual time=0.005..0.888 rows=6,505 loops=613)

14. 1.839 5.517 ↑ 10.0 10 613

Hash (cost=1.00..1.00 rows=100 width=4) (actual time=0.009..0.009 rows=10 loops=613)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
15. 3.678 3.678 ↑ 10.0 10 613

Function Scan on unnest stock_id (cost=0.00..1.00 rows=100 width=4) (actual time=0.006..0.006 rows=10 loops=613)

Planning time : 0.588 ms
Execution time : 1,075.673 ms