Skip site navigation (1) Skip section navigation (2)

Re: Do cast affects index usage?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Anibal David Acosta" <aa(at)devshock(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Do cast affects index usage?
Date: 2012-10-12 20:38:31
Message-ID: 21823.1350074311@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
"Anibal David Acosta" <aa(at)devshock(dot)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


In response to

Responses

pgsql-performance by date

Next:From: Tomas VondraDate: 2012-10-12 21:14:35
Subject: Re: hash aggregation
Previous:From: Scott MarloweDate: 2012-10-12 20:37:37
Subject: Re: Do cast affects index usage?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group