explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Q4RE

Settings
# exclusive inclusive rows x rows loops node
1. 22.297 1,139.630 ↑ 1,327.8 5 1

GroupAggregate (cost=3,283,625.39..3,283,807.97 rows=6,639 width=59) (actual time=1,104.659..1,139.630 rows=5 loops=1)

  • Group Key: x0.panjivacountrytrading, tc.cik
2. 85.136 1,117.333 ↓ 17.9 118,779 1

Sort (cost=3,283,625.39..3,283,641.99 rows=6,639 width=47) (actual time=1,100.807..1,117.333 rows=118,779 loops=1)

  • Sort Key: x0.panjivacountrytrading, tc.cik
  • Sort Method: external merge Disk: 5,640kB
3. 12.677 1,032.197 ↓ 17.9 118,779 1

Nested Loop (cost=0.57..3,283,203.93 rows=6,639 width=47) (actual time=3.175..1,032.197 rows=118,779 loops=1)

4. 0.005 0.005 ↑ 18.0 5 1

Seq Scan on topcountries tc (cost=0.00..10.90 rows=90 width=20) (actual time=0.003..0.005 rows=5 loops=1)

5. 13.950 1,019.515 ↓ 169.7 23,756 5

Nested Loop (cost=0.57..36,478.52 rows=140 width=39) (actual time=0.882..203.903 rows=23,756 loops=5)

6. 0.245 0.245 ↓ 2.3 328 5

Seq Scan on industrycompanies ic (cost=0.00..11.40 rows=140 width=4) (actual time=0.005..0.049 rows=328 loops=5)

7. 1,005.320 1,005.320 ↓ 72.0 72 1,640

Index Scan using ix_instntradesummary_sk on instntradesummary x0 (cost=0.57..260.47 rows=1 width=47) (actual time=0.531..0.613 rows=72 loops=1,640)

  • Index Cond: ((keyinstn = ic.keyinstn) AND ((panjivacountrytrading)::text = (tc.micountry)::text))
  • Filter: ((((tradedatayear)::double precision > date_part('year'::text, (CURRENT_DATE + '-2 years'::interval))) AND ((tradedatayear)::double precision < date_part('year'::text, (CURRENT_DATE)::timestamp without time zone))) OR (((tradedatayear)::double precision = date_part('year'::text, (CURRENT_DATE + '-2 years'::interval))) AND ((tradedatamonth)::double precision >= date_part('month'::text, (CURRENT_DATE)::timestamp without time zone))) OR (((tradedatayear)::double precision = date_part('year'::text, (CURRENT_DATE)::timestamp without time zone)) AND ((tradedatamonth)::double precision <= date_part('month'::text, (CURRENT_DATE)::timestamp without time zone))))
  • Rows Removed by Filter: 358