explain.depesz.com

A tool for finding a real cause for slow queries.

Result: 5Du

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 0.000 171.289 ↓ 0.0 0 1

Nested Loop (cost=8963.45..20780.09 rows=104 width=36) (actual time=171.289..171.289 rows=0 loops=1)

  • Output: kbf.data, kbt.numero_kb, kbpd.lordo, kbpd.tipo, 'D', ((('Fat. '::text || (kbf.numero)::text) || ' per Kontroll Blatt '::text) || (kbt.numero_kb)::text), 0
  • Buffers: shared hit=10449
2.          

Initplan (forNested Loop)

3. 0.037 0.842 ↑ 1.0 1 1

Aggregate (cost=33.48..33.50 rows=1 width=8) (actual time=0.842..0.842 rows=1 loops=1)

  • Output: CASE WHEN (max(pnc_testata.data_chiusura) IS NOT NULL) THEN max(pnc_testata.data_chiusura) ELSE (to_date('01/01/1900'::text, 'dd/MM/yyyy'::text))::timestamp without time zone END
  • Buffers: shared hit=20
4. 0.805 0.805 ↑ 1.0 51 1

Seq Scan on anagrafe.pnc_testata (cost=0.00..33.23 rows=52 width=8) (actual time=0.014..0.805 rows=51 loops=1)

  • Output: pnc_testata.id, pnc_testata.data_cassa, pnc_testata.data_inserimento, pnc_testata.filiale, pnc_testata.totale_lordo_dare, pnc_testata.totale_lordo_avere, pnc_testata.saldo, pnc_testata.chiusa, pnc_testata.username, pnc_testata.data_apertura, pnc_testata.data_chiusura, pnc_testata.username_apertura, pnc_testata.username_chiusura
  • Filter: ((pnc_testata.chiusa IS NOT NULL) AND (pnc_testata.chiusa IS TRUE) AND (pnc_testata.filiale = 163))
  • Buffers: shared hit=20
5. 1.740 171.288 ↓ 0.0 0 1

Nested Loop (cost=8929.95..19637.33 rows=208 width=34) (actual time=171.288..171.288 rows=0 loops=1)

  • Output: kbt.numero_kb, kbt.tipologia_pagamento, kbf.data, kbf.numero, kbpt.id
  • Buffers: shared hit=10449
6. 73.860 161.818 ↓ 1.3 1546 1

Hash Join (cost=8929.95..13969.11 rows=1212 width=23) (actual time=39.729..161.818 rows=1546 loops=1)

  • Output: kbt.numero_kb, kbt.fattura, kbt.tipologia_pagamento, kbpt.id
  • Hash Cond: (kbpt.id = kbt.tipologia_pagamento)
  • Buffers: shared hit=4239
7. 48.409 48.409 ↓ 1.0 199139 1

Seq Scan on anagrafe.kb_tipologia_pagamento_testata kbpt (cost=0.00..4031.36 rows=199136 width=4) (actual time=0.012..48.409 rows=199139 loops=1)

  • Output: kbpt.id, kbpt.totale_lordo, kbpt.totale_netto, kbpt.totale_imposta, kbpt.totale_lordo_old, kbpt.totale_imposta_old, kbpt.totale_netto_old
  • Buffers: shared hit=2040
8. 1.859 39.549 ↑ 1.5 1546 1

Hash (cost=8900.53..8900.53 rows=2353 width=19) (actual time=39.549..39.549 rows=1546 loops=1)

  • Output: kbt.numero_kb, kbt.fattura, kbt.tipologia_pagamento
  • Buckets: 1024 Batches: 1 Memory Usage: 79kB
  • Buffers: shared hit=2199
9. 32.046 37.690 ↓ 1.2 2804 1

Bitmap Heap Scan on anagrafe.kb_testata kbt (cost=343.42..8900.53 rows=2353 width=19) (actual time=6.619..37.690 rows=2804 loops=1)

  • Output: kbt.numero_kb, kbt.fattura, kbt.tipologia_pagamento
  • Recheck Cond: (kbt.filiale_utente = 163)
  • Filter: ((kbt.numero_kb IS NOT NULL) AND (kbt.nota_credito IS NULL) AND ((kbt.tipo_kb)::text <> 'KH'::text))
  • Buffers: shared hit=2199
10. 5.644 5.644 ↓ 1.0 18734 1

Bitmap Index Scan on idx_kt_filiale_ass (cost=0.00..342.84 rows=18474 width=0) (actual time=5.644..5.644 rows=18734 loops=1)

  • Index Cond: (kbt.filiale_utente = 163)
  • Buffers: shared hit=54
11. 7.730 7.730 ↓ 0.0 0 1546

Index Scan using kb_fattura_testata_pkey on anagrafe.kb_fattura_testata kbf (cost=0.00..4.66 rows=1 width=19) (actual time=0.005..0.005 rows=0 loops=1546)

  • Output: kbf.id, kbf.numero, kbf.data, kbf.codice_mo, kbf.netto_prodotti, kbf.lordo_prodotti, kbf.imposta_prodotti, kbf.netto_pagamenti, kbf.lordo_pagamenti, kbf.imposta_pagamenti, kbf.netto_spese, kbf.lordo_spese, kbf.imposta_spese, kbf.netto_recesso, kbf.lordo_recesso, kbf.imposta_recesso, kbf.lordo315_recesso, kbf.stampa_pdf, kbf.saldo, kbf.codice_iva, kbf.iva, kbf.filiale_cliente, kbf.filiale_utente, kbf.progressivo, kbf.codice, kbf.anno, kbf.riepilogo, kbf.lordo_prodotti_old, kbf.netto_prodotti_old, kbf.imposta_prodotti_old, kbf.ditta, kbf.codice_cliente, kbf.data_gcontr, kbf.nr_gcontr, kbf.nr_documento, kbf.nr_riga_doc, kbf.data_documento, kbf.id_testata
  • Index Cond: (kbf.id = kbt.fattura)
  • Filter: (kbf.data > $0)
  • Buffers: shared hit=6210
12. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_testata on anagrafe.kb_tipologia_pagamento_dettaglio kbpd (cost=0.00..5.32 rows=1 width=14) (actual time=.. rows= loops=0)

  • Output: kbpd.id, kbpd.netto, kbpd.lordo, kbpd.imposta, kbpd.tipo, kbpd.num_assegno, kbpd.num_bonifico, kbpd.tipo_carta, kbpd.num_carta, kbpd.intestazione_carta, kbpd.validita_carta, kbpd.rif_contrassegno, kbpd.iban, kbpd.id_testata, kbpd.lordo_old, kbpd.netto_old, kbpd.imposta_old
  • Index Cond: (kbpd.id_testata = kbt.tipologia_pagamento)
  • Filter: (((kbpd.tipo)::text = 'A'::text) OR ((kbpd.tipo)::text = 'C'::text) OR ((kbpd.tipo)::text = 'P'::text))