Ola colegas, ja fiz particionamento em alguns bancos, porem em um dos, nao esta funcioando corretamente.
o problema é q nao sei o motivo. versao do banco: 8.4.5 conf. sql_inheritance = on constraint_exclusion = on olha o exemplo: tabela ocorrencia_evento201109 ( .... CONSTRAINT ocorrencia_evento201109_ocoedt_pacote_check CHECK (ocoedt_pacote >= '2011-09-01'::date AND ocoedt_pacote < '2011-10-01'::date) ) INHERITS (ocorrencia_evento) WITH ( OIDS=FALSE); obs:(isso pra tabelas ocorrencia_evento201106 a ocorrencia_evento201112) exemplo da query SELECT COUNT(*) from ocorrencia_evento where ocoedt_pacote >= '2011-09-21 00:00:00' AND ocoedt_pacote <= '2011-10-20 23:59:00'; o problema é que só deveria percorrer a tabela 201109 e 201110, porem o explain mostra que esta percorrendo todas as tabelas. Aggregate (cost=585580.51..585580.52 rows=1 width=0)" " -> Append (cost=4.91..570750.60 rows=5931962 width=0)" " -> Bitmap Heap Scan on ocorrencia_evento (cost=4.91..15.87 rows=64 width=0)" " Recheck Cond: ((ocoedt_pacote >= '2011-09-21 00:00:00-03'::timestamp with time zone) AND (ocoedt_pacote <= '2011-10-20 23:59:00-02'::timestamp with time zone))" " -> Bitmap Index Scan on ocorrencia_evento_ocoedt_pacote_idx (cost=0.00..4.89 rows=64 width=0)" " Index Cond: ((ocoedt_pacote >= '2011-09-21 00:00:00-03'::timestamp with time zone) AND (ocoedt_pacote <= '2011-10-20 23:59:00-02'::timestamp with time zone))" " -> Index Scan using ocorrencia_evento201112_idx on ocorrencia_evento201112 ocorrencia_evento (cost=0.00..8.85 rows=1 width=0)" " Index Cond: ((ocoedt_pacote >= '2011-09-21 00:00:00-03'::timestamp with time zone) AND (ocoedt_pacote <= '2011-10-20 23:59:00-02'::timestamp with time zone))" " -> Index Scan using ocorrencia_evento201111_idx on ocorrencia_evento201111 ocorrencia_evento (cost=0.00..9.55 rows=1 width=0)" " Index Cond: ((ocoedt_pacote >= '2011-09-21 00:00:00-03'::timestamp with time zone) AND (ocoedt_pacote <= '2011-10-20 23:59:00-02'::timestamp with time zone))" " -> Index Scan using ocorrencia_evento201106_idx on ocorrencia_evento201106 ocorrencia_evento (cost=0.00..8.66 rows=1 width=0)" " Index Cond: ((ocoedt_pacote >= '2011-09-21 00:00:00-03'::timestamp with time zone) AND (ocoedt_pacote <= '2011-10-20 23:59:00-02'::timestamp with time zone))" " -> Index Scan using ocorrencia_evento201107_idx on ocorrencia_evento201107 ocorrencia_evento (cost=0.00..8.97 rows=1 width=0)" " Index Cond: ((ocoedt_pacote >= '2011-09-21 00:00:00-03'::timestamp with time zone) AND (ocoedt_pacote <= '2011-10-20 23:59:00-02'::timestamp with time zone))" " -> Index Scan using ocorrencia_evento201108_idx on ocorrencia_evento201108 ocorrencia_evento (cost=0.00..9.13 rows=1 width=0)" " Index Cond: ((ocoedt_pacote >= '2011-09-21 00:00:00-03'::timestamp with time zone) AND (ocoedt_pacote <= '2011-10-20 23:59:00-02'::timestamp with time zone))" " -> Bitmap Heap Scan on ocorrencia_evento201109 ocorrencia_evento (cost=58118.01..253244.81 rows=2265453 width=0)" " Recheck Cond: ((ocoedt_pacote >= '2011-09-21 00:00:00-03'::timestamp with time zone) AND (ocoedt_pacote <= '2011-10-20 23:59:00-02'::timestamp with time zone))" " -> Bitmap Index Scan on ocorrencia_evento201109_idx (cost=0.00..57551.65 rows=2265453 width=0)" " Index Cond: ((ocoedt_pacote >= '2011-09-21 00:00:00-03'::timestamp with time zone) AND (ocoedt_pacote <= '2011-10-20 23:59:00-02'::timestamp with time zone))" " -> Bitmap Heap Scan on ocorrencia_evento201110 ocorrencia_evento (cost=94062.17..317444.77 rows=3666440 width=0)" " Recheck Cond: ((ocoedt_pacote >= '2011-09-21 00:00:00-03'::timestamp with time zone) AND (ocoedt_pacote <= '2011-10-20 23:59:00-02'::timestamp with time zone))" " -> Bitmap Index Scan on ocorrencia_evento201110_idx (cost=0.00..93145.56 rows=3666440 width=0)" " Index Cond: ((ocoedt_pacote >= '2011-09-21 00:00:00-03'::timestamp with time zone) AND (ocoedt_pacote <= '2011-10-20 23:59:00-02'::timestamp with time zone))"
_______________________________________________ pgbr-geral mailing list [email protected] https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
