From: Anibal David Acosta <aa@devshock.com>
To: 'Tom Lane' <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: Do cast affects index usage?
Date: Fri, 12 Oct 2012 21:27:42 -0300
Message-ID: <000001cda8d9$913a7770$b3af6650$@devshock.com> (raw)
In-Reply-To: <21823.1350074311@sss.pgh.pa.us>
References: <004301cda8b4$fdc57bd0$f9507370$@devshock.com>
<21823.1350074311@sss.pgh.pa.us>
Because I need to get all rows where datetime is greater than (for example)
'2012-10-10 00:00:00' but ignoring timezone, so basically I need to truncate
timezone
This can be done by converting to timestamp without timezone.
-----Mensaje original-----
De: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Enviado el: viernes, 12 de octubre de 2012 05:39 p.m.
Para: Anibal David Acosta
CC: pgsql-performance@postgresql.org
Asunto: Re: [PERFORM] Do cast affects index usage?
"Anibal David Acosta" <aa@devshock.com> writes:
> I have a table with a column of type timestamp with time zone, this
> column has an index
> If I do a select like this
> select * from mytable where cast(my_date as timestamp without time
> zone) >
> '2012-10-12 20:00:00'
> this query will use the index over the my_date column?
No. The cast seems rather pointless though ...
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: aa@devshock.com, tgl@sss.pgh.pa.us
Subject: Re: Do cast affects index usage?
In-Reply-To: <000001cda8d9$913a7770$b3af6650$@devshock.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox