explain.depesz.com

A tool for finding a real cause for slow queries.

Result: Gsy

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 0.009 8,002.366 ↑ 1.0 20 1

Limit (cost=14,817.82..14,838.82 rows=20 width=136) (actual time=7,986.962..8,002.366 rows=20 loops=1)

2. 16.272 8,002.357 ↑ 383.9 20 1

GroupAggregate (cost=14,817.82..22,878.67 rows=7,677 width=136) (actual time=7,986.960..8,002.357 rows=20 loops=1)

3. 84.865 7,986.085 ↑ 365.6 21 1

Sort (cost=14,817.82..14,837.01 rows=7,677 width=136) (actual time=7,986.083..7,986.085 rows=21 loops=1)

  • Sort Key: f.fecha, (fn_getpreciobruto(fp.idfichapedido)), (fn_getdisccountfichapedido(fp.idfichapedido)), f.importe, f.numero, p.idpedido, cp.nombre, cp.apellidos, fp.idfichapedido, p.tdate, fp.idficha
  • Sort Method: quicksort Memory: 1754kB
4. 7,810.000 7,901.220 ↓ 1.3 9,704 1

Hash Right Join (cost=10,440.25..14,322.41 rows=7,677 width=136) (actual time=92.586..7,901.220 rows=9,704 loops=1)

  • Hash Cond: (op.idfichapedido = fp.idfichapedido)
5. 0.181 0.181 ↑ 1.0 941 1

Seq Scan on offerperiod op (cost=0.00..39.41 rows=941 width=4) (actual time=0.004..0.181 rows=941 loops=1)

6. 4.362 91.039 ↓ 1.3 9,704 1

Hash (cost=10,344.29..10,344.29 rows=7,677 width=136) (actual time=91.039..91.039 rows=9,704 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1032kB
7. 13.415 86.677 ↓ 1.3 9,704 1

Hash Join (cost=7,754.58..10,344.29 rows=7,677 width=136) (actual time=65.234..86.677 rows=9,704 loops=1)

  • Hash Cond: (fp.idpedido = p.idpedido)
8. 10.480 10.480 ↑ 1.9 53,022 1

Seq Scan on fichapedido fp (cost=0.00..2,139.05 rows=99,705 width=16) (actual time=0.006..10.480 rows=53,022 loops=1)

9. 4.022 62.782 ↓ 1.2 9,538 1

Hash (cost=7,653.29..7,653.29 rows=8,103 width=132) (actual time=62.782..62.782 rows=9,538 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 954kB
10. 11.757 58.760 ↓ 1.2 9,538 1

Hash Join (cost=5,725.02..7,653.29 rows=8,103 width=132) (actual time=31.244..58.760 rows=9,538 loops=1)

  • Hash Cond: (cp.idpedido = p.idpedido)
11. 16.581 16.581 ↓ 1.0 56,903 1

Seq Scan on cliente_pedido cp (cost=0.00..1,633.90 rows=56,890 width=68) (actual time=0.007..16.581 rows=56,903 loops=1)

12. 3.251 30.422 ↑ 1.6 9,538 1

Hash (cost=5,537.66..5,537.66 rows=14,989 width=64) (actual time=30.422..30.422 rows=9,538 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 680kB
13. 12.132 27.171 ↑ 1.6 9,538 1

Hash Join (cost=1,406.42..5,537.66 rows=14,989 width=64) (actual time=4.712..27.171 rows=9,538 loops=1)

  • Hash Cond: (p.idpedido = f.idpedido)
14. 10.346 10.346 ↑ 1.8 56,945 1

Seq Scan on pedido p (cost=0.00..2,797.40 rows=105,240 width=16) (actual time=0.003..10.346 rows=56,945 loops=1)

15. 2.128 4.693 ↑ 1.6 9,538 1

Hash (cost=1,219.06..1,219.06 rows=14,989 width=48) (actual time=4.693..4.693 rows=9,538 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 559kB
16. 1.850 2.565 ↑ 1.6 9,538 1

Bitmap Heap Scan on factura f (cost=284.44..1,219.06 rows=14,989 width=48) (actual time=0.733..2.565 rows=9,538 loops=1)

  • Recheck Cond: (fecha >= ((((date_part('year'::text, (('now'::text)::date)::timestamp without time zone))::character varying)::text || '-01-01'::text))::date)
17. 0.715 0.715 ↑ 1.6 9,538 1

Bitmap Index Scan on factura_fecha_idx (cost=0.00..280.69 rows=14,989 width=0) (actual time=0.715..0.715 rows=9,538 loops=1)

  • Index Cond: (fecha >= ((((date_part('year'::text, (('now'::text)::date)::timestamp without time zone))::character varying)::text || '-01-01'::text))::date)