Hola Lista Tengo un servidor PostgreSQL 9.6 en le cual implemente particionamiento (por fecha) sobre una tabla, pues sobre esta tabla se generan reportes mensuales de gran cantidad de registros, ajuste el parámetro constraint_exclusion = on para qeu excluyera las tablas que no estan en le rango, Hice una prueba y funciona como se espera:
SELECT q.evento,count(*) FROM queue_log q WHERE q.fecha BETWEEN cast('2017-02-01 00:00:00' as timestamp ) AND cast('2017-02-28 23:59:59' as timestamp) GROUP BY 1 HashAggregate (cost=208639.45..208639.51 rows=21 width=17) (actual time=1090.049..1090.055 rows=17 loops=1) Group Key: q.evento -> Append (cost=0.08..208359.40 rows=280053 width=9) (actual time=0.058..795.635 rows=529426 loops=1) -> Index Scan using queue_log_idx3 on queue_log q (cost=0.08..208359.40 rows=280053 width=9) (actual time=0.056..406.195 rows=529426 loops=1) Index Cond: ((fecha >= '2017-02-01 00:00:00'::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) Planning time: 4.557 ms Execution time: 1090.098 ms Pero si cambio el formato de la fechas (porque realmente esta consulta esta dentro de un jasper y las fechas son parámetros y por lo tanto se concadenan): SELECT q.evento,count(*) FROM queue_log q WHERE q.fecha BETWEEN cast('2017-02-01 ' || ' 00:00:00' as timestamp ) AND cast('2017-02-28 23:59:59' as timestamp) GROUP BY 1 El plan de ejecución: HashAggregate (cost=208929.85..208929.92 rows=21 width=17) (actual time=1029.625..1029.633 rows=17 loops=1) Group Key: q.evento -> Append (cost=0.09..208649.71 rows=280147 width=9) (actual time=0.044..734.454 rows=529426 loops=1) -> Index Scan using queue_log_idx3 on queue_log q (cost=0.09..208359.40 rows=280053 width=9) (actual time=0.042..343.010 rows=529426 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_200904_fecha_idx on queue_log_part_200904 q_1 (cost=0.06..3.06 rows=1 width=10) (actual time=0.020..0.020 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_200905_fecha_idx on queue_log_part_200905 q_2 (cost=0.06..3.06 rows=1 width=10) (actual time=0.007..0.007 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_200906_fecha_idx on queue_log_part_200906 q_3 (cost=0.06..3.06 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_200907_fecha_idx on queue_log_part_200907 q_4 (cost=0.06..3.06 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_200908_fecha_idx on queue_log_part_200908 q_5 (cost=0.08..3.09 rows=1 width=10) (actual time=0.007..0.007 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_200909_fecha_idx on queue_log_part_200909 q_6 (cost=0.08..3.09 rows=1 width=10) (actual time=0.007..0.007 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_200910_fecha_idx on queue_log_part_200910 q_7 (cost=0.08..3.09 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_200911_fecha_idx on queue_log_part_200911 q_8 (cost=0.08..3.09 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_200912_fecha_idx on queue_log_part_200912 q_9 (cost=0.08..3.09 rows=1 width=10) (actual time=0.007..0.007 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201001_fecha_idx on queue_log_part_201001 q_10 (cost=0.09..3.09 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201002_fecha_idx on queue_log_part_201002 q_11 (cost=0.08..3.09 rows=1 width=10) (actual time=0.007..0.007 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201003_fecha_idx on queue_log_part_201003 q_12 (cost=0.08..3.09 rows=1 width=11) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201004_fecha_idx on queue_log_part_201004 q_13 (cost=0.08..3.09 rows=1 width=11) (actual time=0.008..0.008 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201005_fecha_idx on queue_log_part_201005 q_14 (cost=0.08..3.09 rows=1 width=11) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201006_fecha_idx on queue_log_part_201006 q_15 (cost=0.08..3.09 rows=1 width=11) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201007_fecha_idx on queue_log_part_201007 q_16 (cost=0.08..3.09 rows=1 width=11) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201008_fecha_idx on queue_log_part_201008 q_17 (cost=0.08..3.09 rows=1 width=11) (actual time=0.007..0.007 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201009_fecha_idx on queue_log_part_201009 q_18 (cost=0.08..3.09 rows=1 width=11) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201010_fecha_idx on queue_log_part_201010 q_19 (cost=0.08..3.09 rows=1 width=11) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201011_fecha_idx on queue_log_part_201011 q_20 (cost=0.08..3.09 rows=1 width=10) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201012_fecha_idx on queue_log_part_201012 q_21 (cost=0.08..3.09 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201101_fecha_idx on queue_log_part_201101 q_22 (cost=0.08..3.09 rows=1 width=10) (actual time=0.032..0.032 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201102_fecha_idx on queue_log_part_201102 q_23 (cost=0.08..3.09 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201103_fecha_idx on queue_log_part_201103 q_24 (cost=0.08..3.09 rows=1 width=10) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201104_fecha_idx on queue_log_part_201104 q_25 (cost=0.08..3.09 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201105_fecha_idx on queue_log_part_201105 q_26 (cost=0.08..3.09 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201106_fecha_idx on queue_log_part_201106 q_27 (cost=0.08..3.09 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201107_fecha_idx on queue_log_part_201107 q_28 (cost=0.08..3.09 rows=1 width=10) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201108_fecha_idx on queue_log_part_201108 q_29 (cost=0.08..3.09 rows=1 width=10) (actual time=0.015..0.015 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201109_fecha_idx on queue_log_part_201109 q_30 (cost=0.08..3.09 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201110_fecha_idx on queue_log_part_201110 q_31 (cost=0.08..3.09 rows=1 width=10) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201111_fecha_idx on queue_log_part_201111 q_32 (cost=0.08..3.09 rows=1 width=10) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201112_fecha_idx on queue_log_part_201112 q_33 (cost=0.08..3.09 rows=1 width=10) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201201_fecha_idx on queue_log_part_201201 q_34 (cost=0.08..3.09 rows=1 width=10) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201202_fecha_idx on queue_log_part_201202 q_35 (cost=0.09..3.09 rows=1 width=10) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201203_fecha_idx on queue_log_part_201203 q_36 (cost=0.09..3.09 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201204_fecha_idx on queue_log_part_201204 q_37 (cost=0.09..3.09 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201205_fecha_idx on queue_log_part_201205 q_38 (cost=0.09..3.09 rows=1 width=10) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201206_fecha_idx on queue_log_part_201206 q_39 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201207_fecha_idx on queue_log_part_201207 q_40 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201208_fecha_idx on queue_log_part_201208 q_41 (cost=0.09..3.09 rows=1 width=10) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201209_fecha_idx on queue_log_part_201209 q_42 (cost=0.09..3.09 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201210_fecha_idx on queue_log_part_201210 q_43 (cost=0.09..3.09 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201211_fecha_idx on queue_log_part_201211 q_44 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201212_fecha_idx on queue_log_part_201212 q_45 (cost=0.08..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201301_fecha_idx on queue_log_part_201301 q_46 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201302_fecha_idx on queue_log_part_201302 q_47 (cost=0.09..3.09 rows=1 width=10) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201303_fecha_idx on queue_log_part_201303 q_48 (cost=0.08..3.09 rows=1 width=10) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201304_fecha_idx on queue_log_part_201304 q_49 (cost=0.09..3.09 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201305_fecha_idx on queue_log_part_201305 q_50 (cost=0.09..3.09 rows=1 width=10) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201306_fecha_idx on queue_log_part_201306 q_51 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201307_fecha_idx on queue_log_part_201307 q_52 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201308_fecha_idx on queue_log_part_201308 q_53 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201309_fecha_idx on queue_log_part_201309 q_54 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201310_fecha_idx on queue_log_part_201310 q_55 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201311_fecha_idx on queue_log_part_201311 q_56 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201312_fecha_idx on queue_log_part_201312 q_57 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201401_fecha_idx on queue_log_part_201401 q_58 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201402_fecha_idx on queue_log_part_201402 q_59 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201403_fecha_idx on queue_log_part_201403 q_60 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201404_fecha_idx on queue_log_part_201404 q_61 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201405_fecha_idx on queue_log_part_201405 q_62 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201406_fecha_idx on queue_log_part_201406 q_63 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201407_fecha_idx on queue_log_part_201407 q_64 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201408_fecha_idx on queue_log_part_201408 q_65 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201409_fecha_idx on queue_log_part_201409 q_66 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201410_fecha_idx on queue_log_part_201410 q_67 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201411_fecha_idx on queue_log_part_201411 q_68 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201412_fecha_idx on queue_log_part_201412 q_69 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201501_fecha_idx on queue_log_part_201501 q_70 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201502_fecha_idx on queue_log_part_201502 q_71 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201503_fecha_idx on queue_log_part_201503 q_72 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201504_fecha_idx on queue_log_part_201504 q_73 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201505_fecha_idx on queue_log_part_201505 q_74 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201506_fecha_idx on queue_log_part_201506 q_75 (cost=0.09..3.09 rows=1 width=10) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201507_fecha_idx on queue_log_part_201507 q_76 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201508_fecha_idx on queue_log_part_201508 q_77 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201509_fecha_idx on queue_log_part_201509 q_78 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201510_fecha_idx on queue_log_part_201510 q_79 (cost=0.09..3.09 rows=1 width=10) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201511_fecha_idx on queue_log_part_201511 q_80 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201512_fecha_idx on queue_log_part_201512 q_81 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201601_fecha_idx on queue_log_part_201601 q_82 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201602_fecha_idx on queue_log_part_201602 q_83 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201603_fecha_idx on queue_log_part_201603 q_84 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201604_fecha_idx on queue_log_part_201604 q_85 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201605_fecha_idx on queue_log_part_201605 q_86 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201606_fecha_idx on queue_log_part_201606 q_87 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201607_fecha_idx on queue_log_part_201607 q_88 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201608_fecha_idx on queue_log_part_201608 q_89 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201609_fecha_idx on queue_log_part_201609 q_90 (cost=0.09..3.09 rows=1 width=9) (actual time=0.006..0.006 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201610_fecha_idx on queue_log_part_201610 q_91 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201611_fecha_idx on queue_log_part_201611 q_92 (cost=0.09..3.09 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201612_fecha_idx on queue_log_part_201612 q_93 (cost=0.06..3.06 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) -> Index Scan using queue_log_part_201701_fecha_idx on queue_log_part_201701 q_94 (cost=0.03..3.03 rows=1 width=78) (actual time=0.003..0.003 rows=0 loops=1) Index Cond: ((fecha >= ('2017-02-01 00:00:00'::cstring)::timestamp without time zone) AND (fecha <= '2017-02-28 23:59:59'::timestamp without time zone)) Planning time: 9.857 ms Execution time: 1030.559 ms -- Cordialmente, Ing. Hellmuth I. Vargas S.