slow ct

Change label
Query Plan as raw text
Summary
Time Node
Node (ms) Percent
25659.988 100.00%
 Nested Loop (cost=1038.3..1154.56 rows=1 width=279) (actual time=2660.026..25659.988 rows=4606 loops=1)
  Join Filter: (cs.id = br.submission_id)
19577.639 76.30%
  -> Nested Loop (cost=1038.3..1129.56 rows=1 width=285) (actual time=2206.186..19577.639 rows=4606 loops=1)
        Join Filter: (cs.id = ct.submission_id)
13881.133 54.10%
        -> Nested Loop (cost=1038.3..1104.56 rows=1 width=269) (actual time=2071.099..13881.133 rows=4606 loops=1)
              Join Filter: (cs.id = ct.submission_id)
6957.147 27.11%
              -> Nested Loop (cost=1038.3..1079.56 rows=1 width=153) (actual time=1037.824..6957.147 rows=4606 loops=1)
                    Join Filter: (cs.id = ct.submission_id)
166.392 0.65%
                    -> Hash Join (cost=1038.3..1054.56 rows=1 width=57) (actual time=132.902..166.392 rows=4606 loops=1)
                          Hash Cond: (ct.submission_id = cs.id)
55.682 0.22%
                          -> Function Scan on crosstab ct (cost=0.0..12.5 rows=1000 width=13) (actual time=50.410..55.682 rows=4606 loops=1)
82.460 0.32%
                          -> Hash (cost=1037.76..1037.76 rows=43 width=44) (actual time=82.460..82.460 rows=4606 loops=1)
81.040 0.32%
                                -> Hash Join (cost=1016.08..1037.76 rows=43 width=44) (actual time=77.083..81.040 rows=4606 loops=1)
                                      Hash Cond: (ct.submission_id = cs.id)
74.486 0.29%
                                      -> Function Scan on crosstab ct (cost=0.0..12.5 rows=1000 width=36) (actual time=73.913..74.486 rows=4606 loops=1)
3.134 0.01%
                                      -> Hash (cost=957.47..957.47 rows=4689 width=8) (actual time=3.134..3.134 rows=4606 loops=1)
1.974 0.01%
                                            -> Bitmap Heap Scan on canvas_submission cs (cost=92.86..957.47 rows=4689 width=8) (actual time=0.681..1.974 rows=4606 loops=1)
                                                  Recheck Cond: (chart_id = ANY ('{3,18}'::integer[]))
0.650 0.00%
                                                  -> Bitmap Index Scan on canvas_submission_questionnaire_id (cost=0.0..91.69 rows=4689 width=0) (actual time=0.650..0.650 rows=4717 loops=1)
                                                        Index Cond: (chart_id = ANY ('{3,18}'::integer[]))
3238.018 12.62%
                    -> Function Scan on crosstab ct (cost=0.0..12.5 rows=1000 width=96) (actual time=0.197..0.703 rows=4606 loops=4606)
3403.834 13.27%
              -> Function Scan on crosstab ct (cost=0.0..12.5 rows=1000 width=116) (actual time=0.225..0.739 rows=4606 loops=4606)
2261.546 8.81%
        -> Function Scan on crosstab ct (cost=0.0..12.5 rows=1000 width=16) (actual time=0.030..0.491 rows=4606 loops=4606)
2703.722 10.54%
  -> Function Scan on crosstab br (cost=0.0..12.5 rows=1000 width=18) (actual time=0.099..0.587 rows=4606 loops=4606)
Run-time
25.669645 seconds (25669.645 ms)