explain.depesz.com

PostgreSQL's explain analyze made readable

Result: vyZ1 : Optimization for: plan #VK5B

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Limit (cost=1,734,743,395.46..1,734,743,395.47 rows=1 width=280) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Sort (cost=1,734,743,395.46..1,734,743,395.47 rows=1 width=280) (actual rows= loops=)

  • Sort Key: (((pgstatspack_statements_1.total_time - COALESCE(pgstatspack_statements.total_time, 0::double precision)))::numeric(10,3))
3. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1,734,740,978.88..1,734,743,395.45 rows=1 width=280) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2,126.69..4,543.20 rows=1 width=272) (actual rows= loops=)

  • Join Filter: (n2.name = n2_1.name)
5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2,126.41..4,392.64 rows=181 width=276) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Hash Join (cost=2,126.12..4,242.52 rows=181 width=168) (actual rows= loops=)

  • Hash Cond: (n1.name = n1_1.name)
7. 0.000 0.000 ↓ 0.0

Merge Join (cost=1.09..2,111.68 rows=1,068 width=140) (actual rows= loops=)

  • Merge Cond: (pgstatspack_statements.user_name_id = n1.nameid)
8. 0.000 0.000 ↓ 0.0

Index Scan using pgstatspack_statements_pk on pgstatspack_statements (cost=0.56..1,912.44 rows=1,068 width=32) (actual rows= loops=)

  • Index Cond: (snapid = 18951)
9. 0.000 0.000 ↓ 0.0

Index Scan using pgstatspack_names_pkey on pgstatspack_names n1 (cost=0.28..303.21 rows=6,314 width=116) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Hash (cost=2,111.68..2,111.68 rows=1,068 width=140) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Merge Join (cost=1.09..2,111.68 rows=1,068 width=140) (actual rows= loops=)

  • Merge Cond: (pgstatspack_statements_1.user_name_id = n1_1.nameid)
12. 0.000 0.000 ↓ 0.0

Index Scan using pgstatspack_statements_pk on pgstatspack_statements pgstatspack_statements_1 (cost=0.56..1,912.44 rows=1,068 width=32) (actual rows= loops=)

  • Index Cond: (snapid = 18952)
13. 0.000 0.000 ↓ 0.0

Index Scan using pgstatspack_names_pkey on pgstatspack_names n1_1 (cost=0.28..303.21 rows=6,314 width=116) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Index Scan using pgstatspack_names_pkey on pgstatspack_names n2 (cost=0.28..0.82 rows=1 width=116) (actual rows= loops=)

  • Index Cond: (nameid = pgstatspack_statements.query_id)
15. 0.000 0.000 ↓ 0.0

Index Scan using pgstatspack_names_pkey on pgstatspack_names n2_1 (cost=0.28..0.82 rows=1 width=116) (actual rows= loops=)

  • Index Cond: (nameid = pgstatspack_statements_1.query_id)
16. 0.000 0.000 ↓ 0.0

Aggregate (cost=1,734,738,852.20..1,734,738,852.21 rows=1 width=48) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.43..347,605,320.45 rows=92,475,568,783 width=48) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Seq Scan on pgstatspack_statements sb (cost=0.00..273,711.61 rows=14,920,161 width=32) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Index Scan using pgstatspack_statements_idx2 on pgstatspack_statements sa (cost=0.43..15.68 rows=760 width=32) (actual rows= loops=)

  • Index Cond: ((user_name_id = sb.user_name_id) AND (query_id = sb.query_id))