explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7COg

Settings
# exclusive inclusive rows x rows loops node
1. 22.102 885.555 ↑ 1,327.8 5 1

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

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

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

  • Sort Key: x0.panjivacountrytrading, tc.cik
  • Sort Method: external merge Disk: 5640kB
3. 12.633 777.398 ↓ 17.9 118,779 1

Nested Loop (cost=0.57..3,283,203.93 rows=6,639 width=47) (actual time=0.715..777.398 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.004..0.005 rows=5 loops=1)

5. 15.040 764.760 ↓ 169.7 23,756 5

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

6. 0.240 0.240 ↓ 2.3 328 5

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

7. 749.480 749.480 ↓ 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.382..0.457 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
Planning time : 0.504 ms