explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xvON

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 13.048 ↑ 1.0 1 1

Limit (cost=23.88..33.03 rows=1 width=13) (actual time=13.048..13.048 rows=1 loops=1)

2. 0.020 13.047 ↑ 1.0 1 1

Nested Loop Semi Join (cost=23.88..33.03 rows=1 width=13) (actual time=13.047..13.047 rows=1 loops=1)

  • Join Filter: (main_host.id = "ANY_subquery".col1)
  • Rows Removed by Join Filter: 245
3. 0.001 0.080 ↑ 1.0 1 1

Nested Loop (cost=0.28..9.36 rows=1 width=13) (actual time=0.080..0.080 rows=1 loops=1)

  • Join Filter: (main_host.inventory_id = main_inventory.id)
  • Rows Removed by Join Filter: 2
4. 0.071 0.071 ↑ 1.0 1 1

Index Scan using main_host_name_inventory_id_45aecd68_uniq on main_host (cost=0.28..8.30 rows=1 width=17) (actual time=0.071..0.071 rows=1 loops=1)

  • Index Cond: ((name)::text = 'host_5'::text)
  • Filter: (ansible_facts @> '{"ansible_distribution": "RedHat"}'::jsonb)
  • Rows Removed by Filter: 1
5. 0.008 0.008 ↓ 1.5 3 1

Seq Scan on main_inventory (cost=0.00..1.04 rows=2 width=4) (actual time=0.006..0.008 rows=3 loops=1)

  • Filter: (organization_id = 2)
  • Rows Removed by Filter: 1
6. 0.022 12.947 ↓ 123.0 246 1

Materialize (cost=23.60..23.64 rows=2 width=4) (actual time=12.846..12.947 rows=246 loops=1)

7. 0.023 12.925 ↓ 123.0 246 1

Subquery Scan on ANY_subquery (cost=23.60..23.63 rows=2 width=4) (actual time=12.845..12.925 rows=246 loops=1)

8. 0.034 12.902 ↓ 123.0 246 1

Unique (cost=23.60..23.61 rows=2 width=13) (actual time=12.844..12.902 rows=246 loops=1)

9. 0.698 12.868 ↓ 123.0 246 1

Sort (cost=23.60..23.60 rows=2 width=13) (actual time=12.844..12.868 rows=246 loops=1)

  • Sort Key: u0.name, u0.id
  • Sort Method: quicksort Memory: 39kB
10. 0.207 12.170 ↓ 150.0 300 1

Nested Loop (cost=12.02..23.59 rows=2 width=13) (actual time=0.122..12.170 rows=300 loops=1)

  • Join Filter: (u0.inventory_id = u1.id)
  • Rows Removed by Join Filter: 600
11. 11.925 11.963 ↓ 100.0 300 1

Bitmap Heap Scan on main_host u0 (cost=12.02..22.45 rows=3 width=17) (actual time=0.111..11.963 rows=300 loops=1)

  • Recheck Cond: (ansible_facts @> '{"ansible_distribution": "RedHat"}'::jsonb)
  • Heap Blocks: exact=11
12. 0.038 0.038 ↓ 100.0 300 1

Bitmap Index Scan on host_ansible_facts_default_gin (cost=0.00..12.02 rows=3 width=0) (actual time=0.038..0.038 rows=300 loops=1)

  • Index Cond: (ansible_facts @> '{"ansible_distribution": "RedHat"}'::jsonb)
13. 0.000 0.000 ↓ 1.5 3 300

Materialize (cost=0.00..1.05 rows=2 width=4) (actual time=0.000..0.000 rows=3 loops=300)

14. 0.007 0.007 ↓ 1.5 3 1

Seq Scan on main_inventory u1 (cost=0.00..1.04 rows=2 width=4) (actual time=0.006..0.007 rows=3 loops=1)

  • Filter: (organization_id = 2)
  • Rows Removed by Filter: 1