explain.depesz.com

PostgreSQL's explain analyze made readable

Result: XbEz

Settings
# exclusive inclusive rows x rows loops node
1. 584.813 2,930.126 ↑ 4.1 9,649 1

GroupAggregate (cost=339,554.51..347,630.72 rows=40,000 width=128) (actual time=2,298.755..2,930.126 rows=9,649 loops=1)

  • Group Key: fat_conducao_mensal.motorista_id, "classificacaoMotorista"."classificacaoGeral", "classificacaoMotorista"."classificacaoDistanciaPercorrida", "classificacaoMotorista"."classificacaoTempoEmDirecao
2.          

CTE classificacaoMotorista

3. 6.575 953.357 ↓ 48.2 9,649 1

WindowAgg (cost=287,093.49..287,102.49 rows=200 width=192) (actual time=944.454..953.357 rows=9,649 loops=1)

4. 9.315 946.782 ↓ 48.2 9,649 1

Sort (cost=287,093.49..287,093.99 rows=200 width=184) (actual time=944.451..946.782 rows=9,649 loops=1)

  • Sort Key: (trunc((sum((((((((((((((((((((((((COALESCE(fat_conducao_mensal_3.diagnostico_obd_pontos, '0'::numeric) + COALESCE(fat_conducao_mensal_3.distracao_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.fadiga_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.manuseio_celular_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.possivel_colisao_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.previsao_colisao_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.remocao_equipamento_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.cigarro_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.sem_vigencia_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.curvas_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.distancia_perigosa_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.aceleracoes_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.frenagens_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.trepidacoes_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.banguela_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.motor_ocioso_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.rpm_faixa_1_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_faixa_1_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_faixa_2_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_faixa_3_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_via_faixa_1_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_via_faixa_2_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_via_faixa_3_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.camera_obstruida_pontos, '0'::numeric))) / GREATEST((sum(fat_conducao_mensal_3.tempo_direcao) / '3600'::numeric), '1'::numeric)), 2)), (sum(fat_conducao_mensal_3.distancia_percorrida)) DESC, (sum(fat_conducao_mensal_3.tempo_direcao)) DESC
  • Sort Method: quicksort Memory: 1724kB
5. 2.688 937.467 ↓ 48.2 9,649 1

WindowAgg (cost=287,076.85..287,085.85 rows=200 width=184) (actual time=933.911..937.467 rows=9,649 loops=1)

6. 5.313 934.779 ↓ 48.2 9,649 1

Sort (cost=287,076.85..287,077.35 rows=200 width=176) (actual time=933.908..934.779 rows=9,649 loops=1)

  • Sort Key: (trunc((sum((((((((((((((((((((((((COALESCE(fat_conducao_mensal_3.diagnostico_obd_pontos, '0'::numeric) + COALESCE(fat_conducao_mensal_3.distracao_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.fadiga_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.manuseio_celular_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.possivel_colisao_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.previsao_colisao_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.remocao_equipamento_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.cigarro_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.sem_vigencia_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.curvas_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.distancia_perigosa_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.aceleracoes_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.frenagens_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.trepidacoes_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.banguela_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.motor_ocioso_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.rpm_faixa_1_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_faixa_1_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_faixa_2_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_faixa_3_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_via_faixa_1_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_via_faixa_2_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_via_faixa_3_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.camera_obstruida_pontos, '0'::numeric))) * ('100000'::numeric / GREATEST((sum(fat_conducao_mensal_3.distancia_percorrida) / '1000'::numeric), '1'::numeric))), 2)), (sum(fat_conducao_mensal_3.distancia_percorrida)) DESC, (sum(fat_conducao_mensal_3.tempo_direcao)) DESC
  • Sort Method: quicksort Memory: 1711kB
7. 2.711 929.466 ↓ 48.2 9,649 1

WindowAgg (cost=287,060.21..287,069.21 rows=200 width=176) (actual time=925.778..929.466 rows=9,649 loops=1)

8. 5.323 926.755 ↓ 48.2 9,649 1

Sort (cost=287,060.21..287,060.71 rows=200 width=168) (actual time=925.773..926.755 rows=9,649 loops=1)

  • Sort Key: (sum((((((((((((((((((((((((COALESCE(fat_conducao_mensal_3.diagnostico_obd_pontos, '0'::numeric) + COALESCE(fat_conducao_mensal_3.distracao_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.fadiga_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.manuseio_celular_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.possivel_colisao_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.previsao_colisao_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.remocao_equipamento_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.cigarro_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.sem_vigencia_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.curvas_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.distancia_perigosa_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.aceleracoes_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.frenagens_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.trepidacoes_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.banguela_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.motor_ocioso_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.rpm_faixa_1_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_faixa_1_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_faixa_2_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_faixa_3_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_via_faixa_1_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_via_faixa_2_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.vel_via_faixa_3_pontos, '0'::numeric)) + COALESCE(fat_conducao_mensal_3.camera_obstruida_pontos, '0'::numeric)))), (sum(fat_conducao_mensal_3.distancia_percorrida)) DESC, (sum(fat_conducao_mensal_3.tempo_direcao)) DESC
  • Sort Method: quicksort Memory: 1138kB
9. 42.787 921.432 ↓ 48.2 9,649 1

Finalize GroupAggregate (cost=287,026.56..287,052.56 rows=200 width=168) (actual time=875.833..921.432 rows=9,649 loops=1)

  • Group Key: fat_conducao_mensal_3.motorista_id
10. 31.411 878.645 ↓ 68.2 27,299 1

Sort (cost=287,026.56..287,027.56 rows=400 width=104) (actual time=875.811..878.645 rows=27,299 loops=1)

  • Sort Key: fat_conducao_mensal_3.motorista_id
  • Sort Method: external merge Disk: 2696kB
11. 24.118 847.234 ↓ 68.2 27,299 1

Gather (cost=286,965.78..287,009.28 rows=400 width=104) (actual time=819.887..847.234 rows=27,299 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
12. 452.639 823.116 ↓ 45.5 9,100 3

Partial HashAggregate (cost=285,965.78..285,969.28 rows=200 width=104) (actual time=807.622..823.116 rows=9,100 loops=3)

  • Group Key: fat_conducao_mensal_3.motorista_id
13. 14.148 370.477 ↓ 2.5 100,581 3

Append (cost=0.00..283,288.86 rows=39,658 width=108) (actual time=40.634..370.477 rows=100,581 loops=3)

14. 0.001 0.001 ↓ 0.0 0 3

Parallel Seq Scan on fat_conducao_mensal fat_conducao_mensal_3 (cost=0.00..0.00 rows=1 width=408) (actual time=0.000..0.001 rows=0 loops=3)

  • Filter: ((motorista_id IS NOT NULL) AND (mes_ano >= '2018-08-01'::date) AND (mes_ano <= '2019-01-01'::date) AND (uo_motorista_id = ANY ('{287,288,326,399,400,420,421,482,842,874,875,876,877,882,885,886,888,889,890,892,894,895,899,900,903,904,905,906,907,908,909,923,924,931,932,933,936,937,938,952,953,954,955,956,957,958,959,960,961,962,964,965,967,968,969,970,972,973,977,980,985,987,988,990,993,995,999,1000,1001,1002,1006,1007,1008,1009,1010,1011,1012,1013,1014,1021,1022,1023,1024,1025,1026,1027,1029,1030,1032,1037,1038,1039,1040,1041,1042,1043,1044,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1065,1066,1067,1069,1070,1071,1072,1077,1078,1080,1084,1085,1086,1087,1088,1090,1091,1092,1093,1096,1097,1098,1101,1102,1104,1109,1110,1111,1112,1116,1120,1131,1134,1135,1136,1137,1139,1140,1141,1153,1160,1161,1188,1193,1232,1236,1246,1256,1268,1281,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1373,1382,2294,2296,2302,2315,2320,2345,2349,2372,2373,2376,2382,2392,2393,2394,2401,2420,2435,2486,2570,2594,2631,2636,2637,2671,2672,2706,2789,2790,2791,2792,2793,2794,2795,2801,2807,2808,2809,2810,2811,2813,2814,2815,2816,2817,2830,2885,2892,2895,2904,2962,2970,3165,3204,3206,3395,3418,3419,3449,3547,3567,3575,3579,3603,3604,3608,3626,3720,3726,3741,3747,3756,3758,3794,3800,3802,3848,4114,4264,4305,4351,4355}'::bigint[])) AND (uo_veiculo_id = ANY ('{287,288,326,399,400,420,421,482,842,874,875,876,877,882,885,886,888,889,890,892,894,895,899,900,903,904,905,906,907,908,909,923,924,931,932,933,936,937,938,952,953,954,955,956,957,958,959,960,961,962,964,965,967,968,969,970,972,973,977,980,985,987,988,990,993,995,999,1000,1001,1002,1006,1007,1008,1009,1010,1011,1012,1013,1014,1021,1022,1023,1024,1025,1026,1027,1029,1030,1032,1037,1038,1039,1040,1041,1042,1043,1044,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1065,1066,1067,1069,1070,1071,1072,1077,1078,1080,1084,1085,1086,1087,1088,1090,1091,1092,1093,1096,1097,1098,1101,1102,1104,1109,1110,1111,1112,1116,1120,1131,1134,1135,1136,1137,1139,1140,1141,1153,1160,1161,1188,1193,1232,1236,1246,1256,1268,1281,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1373,1382,2294,2296,2302,2315,2320,2345,2349,2372,2373,2376,2382,2392,2393,2394,2401,2420,2435,2486,2570,2594,2631,2636,2637,2671,2672,2706,2789,2790,2791,2792,2793,2794,2795,2801,2807,2808,2809,2810,2811,2813,2814,2815,2816,2817,2830,2885,2892,2895,2904,2962,2970,3165,3204,3206,3395,3418,3419,3449,3547,3567,3575,3579,3603,3604,3608,3626,3720,3726,3741,3747,3756,3758,3794,3800,3802,3848,4114,4264,4305,4351,4355}'::bigint[])))
15. 267.048 302.918 ↓ 2.4 83,254 3

Parallel Bitmap Heap Scan on fat_conducao_mensal fat_conducao_mensal_4 (cost=17,807.74..247,201.93 rows=35,389 width=109) (actual time=40.633..302.918 rows=83,254 loops=3)

  • Recheck Cond: ((uo_veiculo_id = ANY ('{287,288,326,399,400,420,421,482,842,874,875,876,877,882,885,886,888,889,890,892,894,895,899,900,903,904,905,906,907,908,909,923,924,931,932,933,936,937,938,952,953,954,955,956,957,958,959,960,961,962,964,965,967,968,969,970,972,973,977,980,985,987,988,990,993,995,999,1000,1001,1002,1006,1007,1008,1009,1010,1011,1012,1013,1014,1021,1022,1023,1024,1025,1026,1027,1029,1030,1032,1037,1038,1039,1040,1041,1042,1043,1044,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1065,1066,1067,1069,1070,1071,1072,1077,1078,1080,1084,1085,1086,1087,1088,1090,1091,1092,1093,1096,1097,1098,1101,1102,1104,1109,1110,1111,1112,1116,1120,1131,1134,1135,1136,1137,1139,1140,1141,1153,1160,1161,1188,1193,1232,1236,1246,1256,1268,1281,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1373,1382,2294,2296,2302,2315,2320,2345,2349,2372,2373,2376,2382,2392,2393,2394,2401,2420,2435,2486,2570,2594,2631,2636,2637,2671,2672,2706,2789,2790,2791,2792,2793,2794,2795,2801,2807,2808,2809,2810,2811,2813,2814,2815,2816,2817,2830,2885,2892,2895,2904,2962,2970,3165,3204,3206,3395,3418,3419,3449,3547,3567,3575,3579,3603,3604,3608,3626,3720,3726,3741,3747,3756,3758,3794,3800,3802,3848,4114,4264,4305,4351,4355}'::bigint[])) AND (mes_ano >= '2018-08-01'::date) AND (mes_ano <= '2019-01-01'::date))
  • Filter: ((motorista_id IS NOT NULL) AND (uo_motorista_id = ANY ('{287,288,326,399,400,420,421,482,842,874,875,876,877,882,885,886,888,889,890,892,894,895,899,900,903,904,905,906,907,908,909,923,924,931,932,933,936,937,938,952,953,954,955,956,957,958,959,960,961,962,964,965,967,968,969,970,972,973,977,980,985,987,988,990,993,995,999,1000,1001,1002,1006,1007,1008,1009,1010,1011,1012,1013,1014,1021,1022,1023,1024,1025,1026,1027,1029,1030,1032,1037,1038,1039,1040,1041,1042,1043,1044,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1065,1066,1067,1069,1070,1071,1072,1077,1078,1080,1084,1085,1086,1087,1088,1090,1091,1092,1093,1096,1097,1098,1101,1102,1104,1109,1110,1111,1112,1116,1120,1131,1134,1135,1136,1137,1139,1140,1141,1153,1160,1161,1188,1193,1232,1236,1246,1256,1268,1281,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1373,1382,2294,2296,2302,2315,2320,2345,2349,2372,2373,2376,2382,2392,2393,2394,2401,2420,2435,2486,2570,2594,2631,2636,2637,2671,2672,2706,2789,2790,2791,2792,2793,2794,2795,2801,2807,2808,2809,2810,2811,2813,2814,2815,2816,2817,2830,2885,2892,2895,2904,2962,2970,3165,3204,3206,3395,3418,3419,3449,3547,3567,3575,3579,3603,3604,3608,3626,3720,3726,3741,3747,3756,3758,3794,3800,3802,3848,4114,4264,4305,4351,4355}'::bigint[])))
  • Rows Removed by Filter: 9402
  • Heap Blocks: exact=12363
16. 35.870 35.870 ↑ 1.1 278,480 1

Bitmap Index Scan on idx_2018_01_fat_conducao_mensal_uo_veic (cost=0.00..17,786.50 rows=305,206 width=0) (actual time=35.869..35.870 rows=278,480 loops=1)

  • Index Cond: ((uo_veiculo_id = ANY ('{287,288,326,399,400,420,421,482,842,874,875,876,877,882,885,886,888,889,890,892,894,895,899,900,903,904,905,906,907,908,909,923,924,931,932,933,936,937,938,952,953,954,955,956,957,958,959,960,961,962,964,965,967,968,969,970,972,973,977,980,985,987,988,990,993,995,999,1000,1001,1002,1006,1007,1008,1009,1010,1011,1012,1013,1014,1021,1022,1023,1024,1025,1026,1027,1029,1030,1032,1037,1038,1039,1040,1041,1042,1043,1044,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1065,1066,1067,1069,1070,1071,1072,1077,1078,1080,1084,1085,1086,1087,1088,1090,1091,1092,1093,1096,1097,1098,1101,1102,1104,1109,1110,1111,1112,1116,1120,1131,1134,1135,1136,1137,1139,1140,1141,1153,1160,1161,1188,1193,1232,1236,1246,1256,1268,1281,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1373,1382,2294,2296,2302,2315,2320,2345,2349,2372,2373,2376,2382,2392,2393,2394,2401,2420,2435,2486,2570,2594,2631,2636,2637,2671,2672,2706,2789,2790,2791,2792,2793,2794,2795,2801,2807,2808,2809,2810,2811,2813,2814,2815,2816,2817,2830,2885,2892,2895,2904,2962,2970,3165,3204,3206,3395,3418,3419,3449,3547,3567,3575,3579,3603,3604,3608,3626,3720,3726,3741,3747,3756,3758,3794,3800,3802,3848,4114,4264,4305,4351,4355}'::bigint[])) AND (mes_ano >= '2018-08-01'::date) AND (mes_ano <= '2019-01-01'::date))
17. 45.462 53.410 ↓ 4.1 17,327 3

Parallel Bitmap Heap Scan on fat_conducao_mensal fat_conducao_mensal_5 (cost=2,531.79..36,086.93 rows=4,268 width=96) (actual time=10.308..53.410 rows=17,327 loops=3)

  • Recheck Cond: ((uo_veiculo_id = ANY ('{287,288,326,399,400,420,421,482,842,874,875,876,877,882,885,886,888,889,890,892,894,895,899,900,903,904,905,906,907,908,909,923,924,931,932,933,936,937,938,952,953,954,955,956,957,958,959,960,961,962,964,965,967,968,969,970,972,973,977,980,985,987,988,990,993,995,999,1000,1001,1002,1006,1007,1008,1009,1010,1011,1012,1013,1014,1021,1022,1023,1024,1025,1026,1027,1029,1030,1032,1037,1038,1039,1040,1041,1042,1043,1044,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1065,1066,1067,1069,1070,1071,1072,1077,1078,1080,1084,1085,1086,1087,1088,1090,1091,1092,1093,1096,1097,1098,1101,1102,1104,1109,1110,1111,1112,1116,1120,1131,1134,1135,1136,1137,1139,1140,1141,1153,1160,1161,1188,1193,1232,1236,1246,1256,1268,1281,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1373,1382,2294,2296,2302,2315,2320,2345,2349,2372,2373,2376,2382,2392,2393,2394,2401,2420,2435,2486,2570,2594,2631,2636,2637,2671,2672,2706,2789,2790,2791,2792,2793,2794,2795,2801,2807,2808,2809,2810,2811,2813,2814,2815,2816,2817,2830,2885,2892,2895,2904,2962,2970,3165,3204,3206,3395,3418,3419,3449,3547,3567,3575,3579,3603,3604,3608,3626,3720,3726,3741,3747,3756,3758,3794,3800,3802,3848,4114,4264,4305,4351,4355}'::bigint[])) AND (mes_ano >= '2018-08-01'::date) AND (mes_ano <= '2019-01-01'::date))
  • Filter: ((motorista_id IS NOT NULL) AND (uo_motorista_id = ANY ('{287,288,326,399,400,420,421,482,842,874,875,876,877,882,885,886,888,889,890,892,894,895,899,900,903,904,905,906,907,908,909,923,924,931,932,933,936,937,938,952,953,954,955,956,957,958,959,960,961,962,964,965,967,968,969,970,972,973,977,980,985,987,988,990,993,995,999,1000,1001,1002,1006,1007,1008,1009,1010,1011,1012,1013,1014,1021,1022,1023,1024,1025,1026,1027,1029,1030,1032,1037,1038,1039,1040,1041,1042,1043,1044,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1065,1066,1067,1069,1070,1071,1072,1077,1078,1080,1084,1085,1086,1087,1088,1090,1091,1092,1093,1096,1097,1098,1101,1102,1104,1109,1110,1111,1112,1116,1120,1131,1134,1135,1136,1137,1139,1140,1141,1153,1160,1161,1188,1193,1232,1236,1246,1256,1268,1281,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1373,1382,2294,2296,2302,2315,2320,2345,2349,2372,2373,2376,2382,2392,2393,2394,2401,2420,2435,2486,2570,2594,2631,2636,2637,2671,2672,2706,2789,2790,2791,2792,2793,2794,2795,2801,2807,2808,2809,2810,2811,2813,2814,2815,2816,2817,2830,2885,2892,2895,2904,2962,2970,3165,3204,3206,3395,3418,3419,3449,3547,3567,3575,3579,3603,3604,3608,3626,3720,3726,3741,3747,3756,3758,3794,3800,3802,3848,4114,4264,4305,4351,4355}'::bigint[])))
  • Rows Removed by Filter: 1894
  • Heap Blocks: exact=3406
18. 7.948 7.948 ↓ 1.2 57,985 1

Bitmap Index Scan on idx_2019_01_fat_conducao_mensal_uo_veic (cost=0.00..2,529.23 rows=48,968 width=0) (actual time=7.948..7.948 rows=57,985 loops=1)

  • Index Cond: ((uo_veiculo_id = ANY ('{287,288,326,399,400,420,421,482,842,874,875,876,877,882,885,886,888,889,890,892,894,895,899,900,903,904,905,906,907,908,909,923,924,931,932,933,936,937,938,952,953,954,955,956,957,958,959,960,961,962,964,965,967,968,969,970,972,973,977,980,985,987,988,990,993,995,999,1000,1001,1002,1006,1007,1008,1009,1010,1011,1012,1013,1014,1021,1022,1023,1024,1025,1026,1027,1029,1030,1032,1037,1038,1039,1040,1041,1042,1043,1044,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1065,1066,1067,1069,1070,1071,1072,1077,1078,1080,1084,1085,1086,1087,1088,1090,1091,1092,1093,1096,1097,1098,1101,1102,1104,1109,1110,1111,1112,1116,1120,1131,1134,1135,1136,1137,1139,1140,1141,1153,1160,1161,1188,1193,1232,1236,1246,1256,1268,1281,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1373,1382,2294,2296,2302,2315,2320,2345,2349,2372,2373,2376,2382,2392,2393,2394,2401,2420,2435,2486,2570,2594,2631,2636,2637,2671,2672,2706,2789,2790,2791,2792,2793,2794,2795,2801,2807,2808,2809,2810,2811,2813,2814,2815,2816,2817,2830,2885,2892,2895,2904,2962,2970,3165,3204,3206,3395,3418,3419,3449,3547,3567,3575,3579,3603,3604,3608,3626,3720,3726,3741,3747,3756,3758,3794,3800,3802,3848,4114,4264,4305,4351,4355}'::bigint[])) AND (mes_ano >= '2018-08-01'::date) AND (mes_ano <= '2019-01-01'::date))
19. 330.180 2,345.313 ↓ 3.2 301,743 1

Sort (cost=52,452.01..52,689.95 rows=95,177 width=132) (actual time=2,298.649..2,345.313 rows=301,743 loops=1)

  • Sort Key: fat_conducao_mensal.motorista_id, "classificacaoMotorista"."classificacaoGeral", "classificacaoMotorista"."classificacaoDistanciaPercorrida", "classificacaoMotorista"."classificacaoTempoEmDirecao
  • Sort Method: external merge Disk: 41056kB
20. 62.049 2,015.133 ↓ 3.2 301,743 1

Nested Loop (cost=0.00..38,075.17 rows=95,177 width=132) (actual time=944.493..2,015.133 rows=301,743 loops=1)

21. 959.237 959.237 ↓ 48.2 9,649 1

CTE Scan on "classificacaoMotorista" (cost=0.00..4.00 rows=200 width=32) (actual time=944.457..959.237 rows=9,649 loops=1)

22. 38.596 993.847 ↓ 5.2 31 9,649

Append (cost=0.00..190.30 rows=6 width=108) (actual time=0.009..0.103 rows=31 loops=9,649)

23. 0.000 0.000 ↓ 0.0 0 9,649

Seq Scan on fat_conducao_mensal (cost=0.00..0.00 rows=1 width=408) (actual time=0.000..0.000 rows=0 loops=9,649)

  • Filter: ((motorista_id IS NOT NULL) AND (mes_ano >= '2018-08-01'::date) AND (mes_ano <= '2019-01-01'::date) AND ("classificacaoMotorista".motorista_id = motorista_id) AND (uo_motorista_id = ANY ('{287,288,326,399,400,420,421,482,842,874,875,876,877,882,885,886,888,889,890,892,894,895,899,900,903,904,905,906,907,908,909,923,924,931,932,933,936,937,938,952,953,954,955,956,957,958,959,960,961,962,964,965,967,968,969,970,972,973,977,980,985,987,988,990,993,995,999,1000,1001,1002,1006,1007,1008,1009,1010,1011,1012,1013,1014,1021,1022,1023,1024,1025,1026,1027,1029,1030,1032,1037,1038,1039,1040,1041,1042,1043,1044,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1065,1066,1067,1069,1070,1071,1072,1077,1078,1080,1084,1085,1086,1087,1088,1090,1091,1092,1093,1096,1097,1098,1101,1102,1104,1109,1110,1111,1112,1116,1120,1131,1134,1135,1136,1137,1139,1140,1141,1153,1160,1161,1188,1193,1232,1236,1246,1256,1268,1281,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1373,1382,2294,2296,2302,2315,2320,2345,2349,2372,2373,2376,2382,2392,2393,2394,2401,2420,2435,2486,2570,2594,2631,2636,2637,2671,2672,2706,2789,2790,2791,2792,2793,2794,2795,2801,2807,2808,2809,2810,2811,2813,2814,2815,2816,2817,2830,2885,2892,2895,2904,2962,2970,3165,3204,3206,3395,3418,3419,3449,3547,3567,3575,3579,3603,3604,3608,3626,3720,3726,3741,3747,3756,3758,3794,3800,3802,3848,4114,4264,4305,4351,4355}'::bigint[])) AND (uo_veiculo_id = ANY ('{287,288,326,399,400,420,421,482,842,874,875,876,877,882,885,886,888,889,890,892,894,895,899,900,903,904,905,906,907,908,909,923,924,931,932,933,936,937,938,952,953,954,955,956,957,958,959,960,961,962,964,965,967,968,969,970,972,973,977,980,985,987,988,990,993,995,999,1000,1001,1002,1006,1007,1008,1009,1010,1011,1012,1013,1014,1021,1022,1023,1024,1025,1026,1027,1029,1030,1032,1037,1038,1039,1040,1041,1042,1043,1044,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1065,1066,1067,1069,1070,1071,1072,1077,1078,1080,1084,1085,1086,1087,1088,1090,1091,1092,1093,1096,1097,1098,1101,1102,1104,1109,1110,1111,1112,1116,1120,1131,1134,1135,1136,1137,1139,1140,1141,1153,1160,1161,1188,1193,1232,1236,1246,1256,1268,1281,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1373,1382,2294,2296,2302,2315,2320,2345,2349,2372,2373,2376,2382,2392,2393,2394,2401,2420,2435,2486,2570,2594,2631,2636,2637,2671,2672,2706,2789,2790,2791,2792,2793,2794,2795,2801,2807,2808,2809,2810,2811,2813,2814,2815,2816,2817,2830,2885,2892,2895,2904,2962,2970,3165,3204,3206,3395,3418,3419,3449,3547,3567,3575,3579,3603,3604,3608,3626,3720,3726,3741,3747,3756,3758,3794,3800,3802,3848,4114,4264,4305,4351,4355}'::bigint[])))
24. 762.271 762.271 ↓ 6.5 26 9,649

Index Scan using idx_2018_01_fat_conducao_mensal_motorista_id on fat_conducao_mensal fat_conducao_mensal_1 (cost=0.55..154.39 rows=4 width=109) (actual time=0.008..0.079 rows=26 loops=9,649)

  • Index Cond: ((motorista_id = "classificacaoMotorista".motorista_id) AND (motorista_id IS NOT NULL) AND (mes_ano >= '2018-08-01'::date) AND (mes_ano <= '2019-01-01'::date))
  • Filter: ((uo_motorista_id = ANY ('{287,288,326,399,400,420,421,482,842,874,875,876,877,882,885,886,888,889,890,892,894,895,899,900,903,904,905,906,907,908,909,923,924,931,932,933,936,937,938,952,953,954,955,956,957,958,959,960,961,962,964,965,967,968,969,970,972,973,977,980,985,987,988,990,993,995,999,1000,1001,1002,1006,1007,1008,1009,1010,1011,1012,1013,1014,1021,1022,1023,1024,1025,1026,1027,1029,1030,1032,1037,1038,1039,1040,1041,1042,1043,1044,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1065,1066,1067,1069,1070,1071,1072,1077,1078,1080,1084,1085,1086,1087,1088,1090,1091,1092,1093,1096,1097,1098,1101,1102,1104,1109,1110,1111,1112,1116,1120,1131,1134,1135,1136,1137,1139,1140,1141,1153,1160,1161,1188,1193,1232,1236,1246,1256,1268,1281,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1373,1382,2294,2296,2302,2315,2320,2345,2349,2372,2373,2376,2382,2392,2393,2394,2401,2420,2435,2486,2570,2594,2631,2636,2637,2671,2672,2706,2789,2790,2791,2792,2793,2794,2795,2801,2807,2808,2809,2810,2811,2813,2814,2815,2816,2817,2830,2885,2892,2895,2904,2962,2970,3165,3204,3206,3395,3418,3419,3449,3547,3567,3575,3579,3603,3604,3608,3626,3720,3726,3741,3747,3756,3758,3794,3800,3802,3848,4114,4264,4305,4351,4355}'::bigint[])) AND (uo_veiculo_id = ANY ('{287,288,326,399,400,420,421,482,842,874,875,876,877,882,885,886,888,889,890,892,894,895,899,900,903,904,905,906,907,908,909,923,924,931,932,933,936,937,938,952,953,954,955,956,957,958,959,960,961,962,964,965,967,968,969,970,972,973,977,980,985,987,988,990,993,995,999,1000,1001,1002,1006,1007,1008,1009,1010,1011,1012,1013,1014,1021,1022,1023,1024,1025,1026,1027,1029,1030,1032,1037,1038,1039,1040,1041,1042,1043,1044,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1065,1066,1067,1069,1070,1071,1072,1077,1078,1080,1084,1085,1086,1087,1088,1090,1091,1092,1093,1096,1097,1098,1101,1102,1104,1109,1110,1111,1112,1116,1120,1131,1134,1135,1136,1137,1139,1140,1141,1153,1160,1161,1188,1193,1232,1236,1246,1256,1268,1281,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1373,1382,2294,2296,2302,2315,2320,2345,2349,2372,2373,2376,2382,2392,2393,2394,2401,2420,2435,2486,2570,2594,2631,2636,2637,2671,2672,2706,2789,2790,2791,2792,2793,2794,2795,2801,2807,2808,2809,2810,2811,2813,2814,2815,2816,2817,2830,2885,2892,2895,2904,2962,2970,3165,3204,3206,3395,3418,3419,3449,3547,3567,3575,3579,3603,3604,3608,3626,3720,3726,3741,3747,3756,3758,3794,3800,3802,3848,4114,4264,4305,4351,4355}'::bigint[])))
  • Rows Removed by Filter: 0
25. 192.980 192.980 ↓ 5.0 5 9,649

Index Scan using idx_2019_01_fat_conducao_mensal_motorista_id on fat_conducao_mensal fat_conducao_mensal_2 (cost=0.42..35.91 rows=1 width=96) (actual time=0.006..0.020 rows=5 loops=9,649)

  • Index Cond: ((motorista_id = "classificacaoMotorista".motorista_id) AND (motorista_id IS NOT NULL) AND (mes_ano >= '2018-08-01'::date) AND (mes_ano <= '2019-01-01'::date))
  • Filter: ((uo_motorista_id = ANY ('{287,288,326,399,400,420,421,482,842,874,875,876,877,882,885,886,888,889,890,892,894,895,899,900,903,904,905,906,907,908,909,923,924,931,932,933,936,937,938,952,953,954,955,956,957,958,959,960,961,962,964,965,967,968,969,970,972,973,977,980,985,987,988,990,993,995,999,1000,1001,1002,1006,1007,1008,1009,1010,1011,1012,1013,1014,1021,1022,1023,1024,1025,1026,1027,1029,1030,1032,1037,1038,1039,1040,1041,1042,1043,1044,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1065,1066,1067,1069,1070,1071,1072,1077,1078,1080,1084,1085,1086,1087,1088,1090,1091,1092,1093,1096,1097,1098,1101,1102,1104,1109,1110,1111,1112,1116,1120,1131,1134,1135,1136,1137,1139,1140,1141,1153,1160,1161,1188,1193,1232,1236,1246,1256,1268,1281,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1373,1382,2294,2296,2302,2315,2320,2345,2349,2372,2373,2376,2382,2392,2393,2394,2401,2420,2435,2486,2570,2594,2631,2636,2637,2671,2672,2706,2789,2790,2791,2792,2793,2794,2795,2801,2807,2808,2809,2810,2811,2813,2814,2815,2816,2817,2830,2885,2892,2895,2904,2962,2970,3165,3204,3206,3395,3418,3419,3449,3547,3567,3575,3579,3603,3604,3608,3626,3720,3726,3741,3747,3756,3758,3794,3800,3802,3848,4114,4264,4305,4351,4355}'::bigint[])) AND (uo_veiculo_id = ANY ('{287,288,326,399,400,420,421,482,842,874,875,876,877,882,885,886,888,889,890,892,894,895,899,900,903,904,905,906,907,908,909,923,924,931,932,933,936,937,938,952,953,954,955,956,957,958,959,960,961,962,964,965,967,968,969,970,972,973,977,980,985,987,988,990,993,995,999,1000,1001,1002,1006,1007,1008,1009,1010,1011,1012,1013,1014,1021,1022,1023,1024,1025,1026,1027,1029,1030,1032,1037,1038,1039,1040,1041,1042,1043,1044,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1065,1066,1067,1069,1070,1071,1072,1077,1078,1080,1084,1085,1086,1087,1088,1090,1091,1092,1093,1096,1097,1098,1101,1102,1104,1109,1110,1111,1112,1116,1120,1131,1134,1135,1136,1137,1139,1140,1141,1153,1160,1161,1188,1193,1232,1236,1246,1256,1268,1281,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1373,1382,2294,2296,2302,2315,2320,2345,2349,2372,2373,2376,2382,2392,2393,2394,2401,2420,2435,2486,2570,2594,2631,2636,2637,2671,2672,2706,2789,2790,2791,2792,2793,2794,2795,2801,2807,2808,2809,2810,2811,2813,2814,2815,2816,2817,2830,2885,2892,2895,2904,2962,2970,3165,3204,3206,3395,3418,3419,3449,3547,3567,3575,3579,3603,3604,3608,3626,3720,3726,3741,3747,3756,3758,3794,3800,3802,3848,4114,4264,4305,4351,4355}'::bigint[])))
  • Rows Removed by Filter: 0