Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EXPLAIN (ANALYZE, VERBOSE)
- SELECT c.concod,
- cp.conparnum,
- cp.conpardatven
- FROM contrato c
- JOIN contrato_parcela cp USING (concod)
- JOIN contrato_parcela x ON (c.concod = x.concod --This is contrato_parcela's FK to contrato
- AND cp.conpardatven = x.conpardatven
- AND cp.conparnum = x.conparnum
- AND cp.conparseq <> x.conparseq) --This is contrato_parcela's PK
- WHERE carcod = 100
- GROUP BY 1,2,3
- /*************************************************************************************************/
- Group (cost=1379793.20..1379834.52 rows=322 width=14) (actual time=64112.474..64112.746 rows=86 loops=1)
- Output: c.concod, cp.conparnum, cp.conpardatven
- Group Key: c.concod, cp.conparnum, cp.conpardatven
- -> Gather Merge (cost=1379793.20..1379832.12 rows=320 width=14) (actual time=64112.471..64199.103 rows=155 loops=1)
- Output: c.concod, cp.conparnum, cp.conpardatven
- Workers Planned: 4
- Workers Launched: 4
- -> Group (cost=1378793.14..1378793.94 rows=80 width=14) (actual time=64096.603..64096.634 rows=31 loops=5)
- Output: c.concod, cp.conparnum, cp.conpardatven
- Group Key: c.concod, cp.conparnum, cp.conpardatven
- Worker 0: actual time=64094.039..64094.074 rows=33 loops=1
- Worker 1: actual time=64094.093..64094.125 rows=33 loops=1
- Worker 2: actual time=64093.566..64093.591 rows=24 loops=1
- Worker 3: actual time=64093.156..64093.179 rows=25 loops=1
- -> Sort (cost=1378793.14..1378793.34 rows=80 width=14) (actual time=64096.600..64096.607 rows=34 loops=5)
- Output: c.concod, cp.conparnum, cp.conpardatven
- Sort Key: c.concod, cp.conparnum, cp.conpardatven
- Sort Method: quicksort Memory: 27kB
- Worker 0: actual time=64094.037..64094.044 rows=34 loops=1
- Worker 1: actual time=64094.090..64094.096 rows=39 loops=1
- Worker 2: actual time=64093.564..64093.569 rows=29 loops=1
- Worker 3: actual time=64093.153..64093.158 rows=25 loops=1
- -> Nested Loop (cost=34359.20..1378790.62 rows=80 width=14) (actual time=3474.066..64096.432 rows=34 loops=5)
- Output: c.concod, cp.conparnum, cp.conpardatven
- Join Filter: (c.concod = x.concod)
- Worker 0: actual time=3048.647..64093.871 rows=34 loops=1
- Worker 1: actual time=3255.442..64093.896 rows=39 loops=1
- Worker 2: actual time=4789.976..64093.371 rows=29 loops=1
- Worker 3: actual time=4787.954..64092.972 rows=25 loops=1
- -> Hash Join (cost=34358.64..756866.52 rows=863635 width=30) (actual time=1167.848..43118.275 rows=1357506 loops=5)
- Output: c.concod, cp.conparnum, cp.conpardatven, cp.concod, cp.conparseq
- Inner Unique: true
- Hash Cond: (cp.concod = c.concod)
- Worker 0: actual time=1251.163..42968.535 rows=1332136 loops=1
- Worker 1: actual time=1198.173..43042.687 rows=1367669 loops=1
- Worker 2: actual time=1179.430..43150.192 rows=1359708 loops=1
- Worker 3: actual time=1109.819..43046.882 rows=1379615 loops=1
- -> Parallel Seq Scan on public.contrato_parcela cp (cost=0.00..714671.57 rows=2985257 width=22) (actual time=0.792..38747.721 rows=2392501 loops=5)
- Output: cp.conparseq, cp.concod, cp.conparnum, cp.conpardatcad, cp.conpardatven, cp.conparvallan, cp.conpardadadi, cp.conparbancod, cp.conparage, cp.conparcon, cp.conparnumche, cp.conpardatapre, cp.conparborent, cp.conparali, cp.conparati, cp.conparusuinc, cp.conpardatatu, cp.conparusuatu, cp.conpardatinc, cp.conparacocod, cp.enccod, cp.conparstacal, cp.tiplancod, cp.conparidt, cp.conparvalsal, cp.conparvin, cp.conparboratu, cp.conparprocod, cp.conparpro, cp.conpartax, cp.conparvalori
- Worker 0: actual time=0.790..38469.672 rows=2352827 loops=1
- Worker 1: actual time=1.359..38647.384 rows=2409347 loops=1
- Worker 2: actual time=1.027..38760.445 rows=2389255 loops=1
- Worker 3: actual time=0.448..38764.390 rows=2436591 loops=1
- -> Hash (cost=23428.55..23428.55 rows=874407 width=8) (actual time=1160.117..1160.117 rows=879841 loops=5)
- Output: c.concod
- Buckets: 1048576 Batches: 1 Memory Usage: 42561kB
- Worker 0: actual time=1236.146..1236.146 rows=879841 loops=1
- Worker 1: actual time=1190.840..1190.841 rows=879841 loops=1
- Worker 2: actual time=1171.834..1171.834 rows=879841 loops=1
- Worker 3: actual time=1103.042..1103.042 rows=879841 loops=1
- -> Index Only Scan using contrato_iu0004 on public.contrato c (cost=0.43..23428.55 rows=874407 width=8) (actual time=0.130..769.098 rows=879841 loops=5)
- Output: c.concod
- Index Cond: (c.carcod = 100)
- Heap Fetches: 140473
- Worker 0: actual time=0.254..817.281 rows=879841 loops=1
- Worker 1: actual time=0.146..807.609 rows=879841 loops=1
- Worker 2: actual time=0.112..785.281 rows=879841 loops=1
- Worker 3: actual time=0.107..727.101 rows=879841 loops=1
- -> Index Scan using contrato_parcela_iu0010 on public.contrato_parcela x (cost=0.56..0.71 rows=1 width=22) (actual time=0.014..0.014 rows=0 loops=6787531)
- Output: x.conparseq, x.concod, x.conparnum, x.conpardatcad, x.conpardatven, x.conparvallan, x.conpardadadi, x.conparbancod, x.conparage, x.conparcon, x.conparnumche, x.conpardatapre, x.conparborent, x.conparali, x.conparati, x.conparusuinc, x.conpardatatu, x.conparusuatu, x.conpardatinc, x.conparacocod, x.enccod, x.conparstacal, x.tiplancod, x.conparidt, x.conparvalsal, x.conparvin, x.conparboratu, x.conparprocod, x.conparpro, x.conpartax, x.conparvalori
- Index Cond: ((x.conpardatven = cp.conpardatven) AND (x.concod = cp.concod))
- Filter: ((cp.conparseq <> x.conparseq) AND (cp.conparnum = x.conparnum))
- Rows Removed by Filter: 1
- Worker 0: actual time=0.014..0.014 rows=0 loops=1332136
- Worker 1: actual time=0.014..0.014 rows=0 loops=1367669
- Worker 2: actual time=0.014..0.014 rows=0 loops=1359708
- Worker 3: actual time=0.014..0.014 rows=0 loops=1379615
- Planning time: 2.652 ms
- Execution time: 64200.962 ms
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement