From: | marcelo Cortez <jmdc_marcelo(at)yahoo(dot)com(dot)ar> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | query don't optimize |
Date: | 2005-07-22 17:23:17 |
Message-ID: | 20050722172317.17576.qmail@web32606.mail.mud.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
hi folks
the query:
SELECT P.ACT_INCORPORADA, P.FECHA_INICIO,
P.OBSERVACIONES1
FROM PASEST AS P
WHERE
P.FECHA_INICIO between '1999-08-22
00:00:00.000000'::timestamp AND '1999-12-22
23:59:00.000000'::timestamp
ORDER BY P.ACT_INCORPORADA
make table scan , the planner don't optimize it, the
table definition is
CREATE TABLE pasest
(
act_principal char(24) NOT NULL,
fecha_inicio timestamp NOT NULL,
act_incorporada char(24) NOT NULL,
codigo_incorporado char(1) NOT NULL,
fecha_fin timestamp,
id_repart_origen int4 NOT NULL,
id_repart_destino int4 NOT NULL,
fojas numeric(4) NOT NULL,
recibo_suelto char(1),
ficha_tramite numeric(6),
numer_remito int4,
id_reparticion_u int4 NOT NULL,
observaciones1 varchar(250),
observaciones2 varchar(250),
cod_permanencia char(2),
estado_pase char(1),
paq_actua_anterior char(1) NOT NULL DEFAULT
''::bpchar,
actua_caratulacion char(1) NOT NULL DEFAULT
''::bpchar,
param_01 char(1) NOT NULL DEFAULT ''::bpchar,
param_02 char(1) NOT NULL DEFAULT ''::bpchar,
param_03 char(1) NOT NULL DEFAULT ''::bpchar,
fts_observaciones tsvector,
CONSTRAINT pk_pasest PRIMARY KEY (act_principal,
fecha_inicio, act_incorporada),
CONSTRAINT fk_permanencia FOREIGN KEY
(cod_permanencia)
REFERENCES permanet (codigo_permanencia) MATCH
SIMPLE
ON UPDATE RESTRICT ON DELETE RESTRICT,
CONSTRAINT fx_caratult FOREIGN KEY (act_principal)
REFERENCES caratult (actuacion_car) MATCH SIMPLE
ON UPDATE RESTRICT ON DELETE RESTRICT,
CONSTRAINT fx_reparticion_destino FOREIGN KEY
(id_repart_destino)
REFERENCES repartit (id_reparticion) MATCH
SIMPLE
ON UPDATE RESTRICT ON DELETE RESTRICT,
CONSTRAINT fx_reparticion_id_reparticion_u FOREIGN
KEY (id_reparticion_u)
REFERENCES repartit (id_reparticion) MATCH
SIMPLE
ON UPDATE RESTRICT ON DELETE RESTRICT,
CONSTRAINT fx_reparticion_origen FOREIGN KEY
(id_repart_origen)
REFERENCES repartit (id_reparticion) MATCH
SIMPLE
ON UPDATE RESTRICT ON DELETE RESTRICT
)
WITHOUT OIDS;
ALTER TABLE pasest OWNER TO postgres;
and have this index
CREATE INDEX ix9_pasest
ON pasest
USING btree
(fecha_inicio);
why planner don't optimize it ?
any ideas?
"PostgreSQL 7.4.3 on i386-pc-linux-gnu, compiled by
GCC 2.95.4"
Linux serverf 2.4.26-1-686-smp #1 SMP
4 gigabytes
hp proliant series
TIA
best regards
MDC
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2005-07-22 17:25:36 | Re: RAMFS with Postgres |
Previous Message | Audrey Bergeron-Morin | 2005-07-22 17:21:07 | Re: Can't connect after restart |