explain.depesz.com

PostgreSQL's explain analyze made readable

Result: f5iI

Settings
# exclusive inclusive rows x rows loops node
1. 868.943 3,434.874 ↑ 2.0 1,000,002 1

Sort (cost=862,184.16..867,184.30 rows=2,000,054 width=118) (actual time=3,168.411..3,434.874 rows=1,000,002 loops=1)

  • Sort Key: labels.title
  • Sort Method: external merge Disk: 70368kB
2. 685.839 2,565.931 ↑ 2.0 1,000,002 1

Merge Semi Join (cost=217,359.58..406,756.44 rows=2,000,054 width=118) (actual time=751.966..2,565.931 rows=1,000,002 loops=1)

  • Merge Cond: (labels.id = labels_1.id)
3. 752.133 752.133 ↑ 1.0 4,000,001 1

Index Scan using labels_pkey on labels (cost=0.43..149,336.04 rows=4,000,107 width=118) (actual time=0.017..752.133 rows=4,000,001 loops=1)

4. 113.660 1,127.959 ↑ 1.0 1,000,002 1

Materialize (cost=217,359.15..234,894.72 rows=1,002,033 width=4) (actual time=751.945..1,127.959 rows=1,000,002 loops=1)

5. 145.110 1,014.299 ↑ 1.0 1,000,002 1

Unique (cost=217,359.15..222,369.31 rows=1,002,033 width=4) (actual time=751.943..1,014.299 rows=1,000,002 loops=1)

6. 516.056 869.189 ↑ 1.0 1,000,002 1

Sort (cost=217,359.15..219,864.23 rows=1,002,033 width=4) (actual time=751.942..869.189 rows=1,000,002 loops=1)

  • Sort Key: labels_1.id
  • Sort Method: external sort Disk: 13688kB
7. 86.627 353.133 ↑ 1.0 1,000,002 1

Append (cost=0.43..103,781.52 rows=1,002,033 width=4) (actual time=0.046..353.133 rows=1,000,002 loops=1)

8. 0.044 0.044 ↑ 1.0 1 1

Index Scan using index_labels_on_group_id_and_project_id_and_title on labels labels_1 (cost=0.43..8.45 rows=1 width=4) (actual time=0.044..0.044 rows=1 loops=1)

  • Index Cond: (group_id = 2)
  • Filter: ((type)::text = 'GroupLabel'::text)
9. 138.217 266.462 ↑ 1.0 1,000,001 1

Bitmap Heap Scan on labels labels_2 (cost=33,267.26..93,752.74 rows=1,002,032 width=4) (actual time=130.040..266.462 rows=1,000,001 loops=1)

  • Recheck Cond: (((type)::text = 'ProjectLabel'::text) AND (project_id = 1))
  • Heap Blocks: exact=11366
10. 128.245 128.245 ↑ 1.0 1,000,001 1

Bitmap Index Scan on index_labels_on_type_and_project_id (cost=0.00..33,016.75 rows=1,002,032 width=0) (actual time=128.245..128.245 rows=1,000,001 loops=1)

  • Index Cond: (((type)::text = 'ProjectLabel'::text) AND (project_id = 1))