QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------- HashAggregate (cost=585169544090.96..675589722275.63 rows=202007 width=65) Group Key: ref_0.radi_usua_actu, ref_0.radi_usua_radi, ref_0.radi_nume_asoc, ref_0.radi_usua_actu, CASE WHEN (pg_rotate_logfile_old() AND NULL::boolean) THEN ref_0.radi_usua_rem ELSE ref_0.radi_usua_rem END, NULLIF($0, pg_stat_get _buf_alloc()) Planned Partitions: 16 InitPlan 1 (returns $0) -> Limit (cost=0.10..0.12 rows=1 width=8) -> Seq Scan on hist_eventos_2 (cost=0.00..118555.22 rows=4844222 width=8) -> Result (cost=0.01..88461384682.66 rows=3857927451714 width=65) One-Time Filter: (NULLIF(NULL::real, NULL::real) >= '3.141592653589793'::double precision) -> Nested Loop (cost=0.01..59526928794.81 rows=3857927451714 width=30) -> Seq Scan on radicado_2 ref_0 (cost=0.00..53449.74 rows=798774 width=30) Filter: (radi_usua_dest IS NOT NULL) -> Materialize (cost=0.00..156323.17 rows=4829811 width=0) -> Seq Scan on hist_eventos_1 ref_1 (cost=0.00..118024.11 rows=4829811 width=0) (13 rows)