explain.depesz.com

PostgreSQL's explain analyze made readable

Result: o1bQ

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 0.140 ↑ 1.0 1 1

Aggregate (cost=18.38..18.39 rows=1 width=128) (actual time=0.140..0.140 rows=1 loops=1)

2. 0.008 0.136 ↑ 4.0 1 1

HashAggregate (cost=18.25..18.29 rows=4 width=1,488) (actual time=0.136..0.136 rows=1 loops=1)

  • Group Key: i.c_invoice_id, i.ad_client_id, i.ad_org_id, i.isactive, i.created, i.createdby, i.updated, i.updatedby, i.issotrx, i.documentno, i.docstatus, i.docaction, i.processing, i.processed, i.c_doctype_id, i.c_doctypetarget_id, i.c_order_id, i.description, i.isapproved, i.istransferred, i.salesrep_id, i.dateinvoiced, i.dateprinted, i.dateacct, i.c_bpartner_id, i.c_bpartner_location_id, i.ad_user_id, i.poreference, i.dateordered, i.c_currency_id, i.c_conversiontype_id, i.paymentrule, i.c_paymentterm_id, i.c_charge_id, i.m_pricelist_id, i.c_campaign_id, i.c_project_id, i.c_activity_id, i.isprinted, i.isdiscountprinted, i.ispaid, i.isindispute, i.ispayschedulevalid, (NULL::numeric), i.invoicecollectiontype, i.dunninggrace, (CASE WHEN ((charat((d.docbasetype)::character varying, 3))::text = 'C'::text) THEN (i.chargeamt * '-1'::numeric) ELSE i.chargeamt END), (CASE WHEN ((charat((d.docbasetype)::character varying, 3))::text = 'C'::text) THEN (i.totallines * '-1'::numeric) ELSE i.totallines END), (CASE WHEN ((charat((d.docbasetype)::character varying, 3))::text = 'C'::text) THEN (i.grandtotal * '-1'::numeric) ELSE i.grandtotal END), (CASE WHEN ((charat((d.docbasetype)::character varying, 3))::text = 'C'::text) THEN '-1.0'::numeric ELSE 1.0 END), (CASE WHEN ((charat((d.docbasetype)::character varying, 2))::text = 'P'::text) THEN '-1.0'::numeric ELSE 1.0 END), d.docbasetype, (paymenttermduedate(i.c_paymentterm_id, (i.dateinvoiced)::timestamp with time zone)), i.ad_orgtrx_id, i.c_payment_id, i.isselfservice, i.posted, i.processedon, i.reversal_id, i.cof_c_custody_id, i.cof_datescheduled
3. 0.000 0.128 ↑ 4.0 1 1

Append (cost=0.56..17.64 rows=4 width=1,488) (actual time=0.125..0.128 rows=1 loops=1)

4. 0.001 0.011 ↓ 0.0 0 1

Nested Loop (cost=0.56..6.56 rows=1 width=541) (actual time=0.011..0.011 rows=0 loops=1)

5. 0.010 0.010 ↓ 0.0 0 1

Index Scan using c_invoice_pkey on c_invoice i (cost=0.42..2.64 rows=1 width=352) (actual time=0.010..0.010 rows=0 loops=1)

  • Index Cond: (c_invoice_id = '5150196'::numeric)
  • Filter: (ispayschedulevalid <> 'Y'::bpchar)
  • Rows Removed by Filter: 1
6. 0.000 0.000 ↓ 0.0 0

Index Scan using c_doctype_pkey on c_doctype d (cost=0.14..2.36 rows=1 width=10) (never executed)

  • Index Cond: (c_doctype_id = i.c_doctype_id)
7. 0.003 0.117 ↑ 3.0 1 1

Subquery Scan on *SELECT* 2 (cost=0.98..11.08 rows=3 width=516) (actual time=0.114..0.117 rows=1 loops=1)

8. 0.089 0.114 ↑ 3.0 1 1

Nested Loop (cost=0.98..11.02 rows=3 width=460) (actual time=0.112..0.114 rows=1 loops=1)

9. 0.001 0.013 ↑ 1.0 1 1

Nested Loop (cost=0.56..5.02 rows=1 width=333) (actual time=0.012..0.013 rows=1 loops=1)

10. 0.004 0.004 ↑ 1.0 1 1

Index Scan using c_invoice_pkey on c_invoice i_1 (cost=0.42..2.64 rows=1 width=329) (actual time=0.002..0.004 rows=1 loops=1)

  • Index Cond: (c_invoice_id = '5150196'::numeric)
  • Filter: (ispayschedulevalid = 'Y'::bpchar)
11. 0.008 0.008 ↑ 1.0 1 1

Index Scan using c_doctype_pkey on c_doctype d_1 (cost=0.14..2.36 rows=1 width=10) (actual time=0.008..0.008 rows=1 loops=1)

  • Index Cond: (c_doctype_id = i_1.c_doctype_id)
12. 0.012 0.012 ↑ 3.0 1 1

Index Scan using idx_c_invoicepayschedule_c_invoice_id_c_invoicepayschedule_id on c_invoicepayschedule ips (cost=0.42..3.67 rows=3 width=35) (actual time=0.011..0.012 rows=1 loops=1)

  • Index Cond: (c_invoice_id = '5150196'::numeric)
  • Filter: (isvalid = 'Y'::bpchar)