explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uVTO

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.187 11,380.606 ↑ 1.0 200 1

Limit (cost=155,097.47..322,965.23 rows=200 width=712) (actual time=3,167.506..11,380.606 rows=200 loops=1)

2. 30.028 11,380.419 ↑ 8.3 200 1

Hash Semi Join (cost=155,097.47..1,548,399.84 rows=1,660 width=712) (actual time=3,167.504..11,380.419 rows=200 loops=1)

  • Hash Cond: ((devices.device_id)::text = (last_active_host_device_by_user.device_id)::text)
3. 17.177 10,578.181 ↓ 2.2 7,712 1

Nested Loop (cost=106,203.00..1,490,219.81 rows=3,460 width=712) (actual time=2,393.557..10,578.181 rows=7,712 loops=1)

4. 13.846 2,742.236 ↑ 15.7 12,066 1

Nested Loop (cost=106,202.44..1,206,813.73 rows=189,114 width=675) (actual time=2,393.405..2,742.236 rows=12,066 loops=1)

5. 9.345 2,438.758 ↑ 38.0 12,068 1

Unique (cost=106,201.89..110,782.78 rows=458,089 width=81) (actual time=2,393.360..2,438.758 rows=12,068 loops=1)

6. 1,969.812 2,429.413 ↑ 38.0 12,068 1

Sort (cost=106,201.89..107,347.11 rows=458,089 width=81) (actual time=2,393.349..2,429.413 rows=12,068 loops=1)

  • Sort Key: token_info_view.tokenization_id, token_info_view.device_id, token_info_view.state
  • Sort Method: external merge Disk: 40,712kB
7. 177.570 459.601 ↓ 1.0 458,602 1

Append (cost=0.00..41,208.95 rows=458,089 width=81) (actual time=0.012..459.601 rows=458,602 loops=1)

8. 1.918 1.918 ↑ 1.0 4,475 1

Seq Scan on token_info_view (cost=0.00..258.21 rows=4,475 width=81) (actual time=0.011..1.918 rows=4,475 loops=1)

  • Filter: ((state)::text = 'ACTIVE'::text)
  • Rows Removed by Filter: 262
9. 129.517 129.517 ↓ 1.0 218,414 1

Seq Scan on token_info_view token_info_view_1 (cost=0.00..22,769.97 rows=218,031 width=81) (actual time=0.006..129.517 rows=218,414 loops=1)

  • Filter: ((state)::text = 'ACTIVE'::text)
  • Rows Removed by Filter: 21,744
10. 150.596 150.596 ↓ 1.0 235,713 1

Seq Scan on tokenization_view (cost=0.00..13,599.88 rows=235,583 width=81) (actual time=0.013..150.596 rows=235,713 loops=1)

  • Filter: ((state)::text = 'ACTIVE'::text)
  • Rows Removed by Filter: 17,957
11. 289.632 289.632 ↑ 1.0 1 12,068

Index Scan using devices_pkey on devices payment_devices (cost=0.56..2.37 rows=1 width=159) (actual time=0.023..0.024 rows=1 loops=12,068)

  • Index Cond: ((device_id)::text = (token_info_view.device_id)::text)
  • Filter: ((device_type)::text = 'WATCH'::text)
  • Rows Removed by Filter: 0
12. 7,818.768 7,818.768 ↑ 1.0 1 12,066

Index Scan using device_by_user_id_idx on devices (cost=0.56..1.49 rows=1 width=74) (actual time=0.432..0.648 rows=1 loops=12,066)

  • Index Cond: ((user_id)::text = (payment_devices.user_id)::text)
  • Filter: ((device_json ->> 'manufacturerName'::text) = 'Apple'::text)
  • Rows Removed by Filter: 2
13. 443.381 772.210 ↓ 1.0 1,106,364 1

Hash (cost=26,442.10..26,442.10 rows=1,105,310 width=37) (actual time=772.210..772.210 rows=1,106,364 loops=1)

  • Buckets: 65,536 Batches: 32 Memory Usage: 2,838kB
14. 328.829 328.829 ↓ 1.0 1,106,364 1

Seq Scan on last_active_host_device_by_user (cost=0.00..26,442.10 rows=1,105,310 width=37) (actual time=0.004..328.829 rows=1,106,364 loops=1)

Planning time : 0.899 ms
Execution time : 11,400.213 ms