explain.depesz.com

PostgreSQL's explain analyze made readable

Result: oriQ

Settings
# exclusive inclusive rows x rows loops node
1. 0.027 53.400 ↑ 2.0 25 1

Nested Loop (cost=47.65..8,205.85 rows=51 width=53) (actual time=0.065..53.400 rows=25 loops=1)

2. 0.004 53.035 ↑ 2.0 26 1

Append (cost=47.36..8,093.66 rows=51 width=48) (actual time=0.025..53.035 rows=26 loops=1)

3. 0.000 0.025 ↑ 25.0 1 1

Subquery Scan on *SELECT* 1 (cost=47.36..47.68 rows=25 width=48) (actual time=0.024..0.025 rows=1 loops=1)

4. 0.000 0.025 ↑ 25.0 1 1

Limit (cost=47.36..47.43 rows=25 width=67) (actual time=0.024..0.025 rows=1 loops=1)

5. 0.007 0.025 ↑ 320.0 1 1

Sort (cost=47.36..48.16 rows=320 width=67) (actual time=0.024..0.025 rows=1 loops=1)

  • Sort Key: (count(*)) DESC
  • Sort Method: quicksort Memory: 25kB
6. 0.006 0.018 ↑ 320.0 1 1

HashAggregate (cost=35.13..38.33 rows=320 width=67) (actual time=0.017..0.018 rows=1 loops=1)

  • Group Key: e.userid, e.type
7. 0.012 0.012 ↑ 960.0 1 1

Index Scan using idx_event_type_leaderboard_types on event e (cost=0.12..27.93 rows=960 width=27) (actual time=0.012..0.012 rows=1 loops=1)

  • Index Cond: (type = 'appointment.booked'::text)
  • Filter: (createdat >= (now() - '30 days'::interval))
8. 0.000 0.007 ↓ 0.0 0 1

Subquery Scan on *SELECT* 2 (cost=1.18..1.19 rows=1 width=48) (actual time=0.007..0.007 rows=0 loops=1)

9. 0.000 0.007 ↓ 0.0 0 1

Limit (cost=1.18..1.18 rows=1 width=67) (actual time=0.007..0.007 rows=0 loops=1)

10. 0.001 0.007 ↓ 0.0 0 1

Sort (cost=1.18..1.18 rows=1 width=67) (actual time=0.007..0.007 rows=0 loops=1)

  • Sort Key: (count(*)) DESC
  • Sort Method: quicksort Memory: 25kB
11. 0.000 0.006 ↓ 0.0 0 1

HashAggregate (cost=1.16..1.17 rows=1 width=67) (actual time=0.006..0.006 rows=0 loops=1)

  • Group Key: e_1.userid, e_1.type
12. 0.007 0.007 ↓ 0.0 0 1

Index Scan using idx_event_type_leaderboard_types on event e_1 (cost=0.12..1.15 rows=1 width=27) (actual time=0.006..0.007 rows=0 loops=1)

  • Index Cond: (type = 'sales.closed'::text)
  • Filter: (createdat >= (now() - '30 days'::interval))
13. 0.003 52.999 ↑ 1.0 25 1

Subquery Scan on *SELECT* 3 (cost=8,044.48..8,044.79 rows=25 width=48) (actual time=52.991..52.999 rows=25 loops=1)

14. 0.003 52.996 ↑ 1.0 25 1

Limit (cost=8,044.48..8,044.54 rows=25 width=48) (actual time=52.991..52.996 rows=25 loops=1)

15. 0.010 52.993 ↑ 5.7 25 1

Sort (cost=8,044.48..8,044.84 rows=143 width=48) (actual time=52.991..52.993 rows=25 loops=1)

  • Sort Key: (count(*)) DESC
  • Sort Method: quicksort Memory: 27kB
16. 27.222 52.983 ↑ 4.0 36 1

HashAggregate (cost=8,039.01..8,040.44 rows=143 width=48) (actual time=52.978..52.983 rows=36 loops=1)

  • Group Key: cu.userid, 'leads'::text
17. 25.761 25.761 ↑ 1.2 174,144 1

Index Only Scan using idx_creditusage_createdat_userid on creditusage cu (cost=0.56..6,510.68 rows=203,778 width=40) (actual time=0.021..25.761 rows=174,144 loops=1)

  • Index Cond: (createdat >= (now() - '30 days'::interval))
  • Heap Fetches: 471
18. 0.338 0.338 ↑ 1.0 1 26

Index Scan using user_pkey on "user" u (cost=0.29..2.19 rows=1 width=21) (actual time=0.013..0.013 rows=1 loops=26)

  • Index Cond: (id = "*SELECT* 1".userid)
  • Filter: (username !~* 'tam@seamlesscontacts.com|tam-|tam+'::text)
  • Rows Removed by Filter: 0