| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "mdc(at)keko(dot)com(dot)ar" <mdc(at)keko(dot)com(dot)ar> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: help with query!!! |
| Date: | 2003-04-14 23:34:45 |
| Message-ID: | 2619.1050363285@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
"mdc(at)keko(dot)com(dot)ar" <mdc(at)keko(dot)com(dot)ar> writes:
> numeroVia | smallint | not null
> fechaHora | timestamp(3) with time zone | not null
> explain delete from "Transitos"
> where "codigoEstacion"= '02' and
> "numeroVia" = 1 and
> "fechaHora" = '2003-0403 17:34:06.92'::timestamp and
> "medioPago" = 'Efectivo' and
> "tipoTransito"= 'Normal' and
> categoria='01'
You're casting the constant compared to fechaHora to timestamp, which is
the wrong thing (timestamp != timestamp with timezone); and you're not
casting the constant compared to numeroVia to smallint. Each of these
type mismatches will prevent an indexscan.
If I were you I'd declare numeroVia as int, not smallint, because you're
getting no space savings from smallint anyway. Then you could just
write
delete from "Transitos"
where "codigoEstacion"= '02' and
"numeroVia" = 1 and
"fechaHora" = '2003-0403 17:34:06.92' and
"medioPago" = 'Efectivo' and
"tipoTransito"= 'Normal' and
categoria='01'
and it should do what you want.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sigi Jekabsons | 2003-04-15 00:49:23 | fast case-insensitive sort |
| Previous Message | Stephan Szabo | 2003-04-14 23:29:42 | Re: help with query!!! |