Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TMm0C-0005Sq-ER for pgsql-performance@postgresql.org; Fri, 12 Oct 2012 20:38:36 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TMm09-0002iH-Qg for pgsql-performance@postgresql.org; Fri, 12 Oct 2012 20:38:35 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q9CKcW1O021824; Fri, 12 Oct 2012 16:38:32 -0400 (EDT) From: Tom Lane To: "Anibal David Acosta" cc: pgsql-performance@postgresql.org Subject: Re: Do cast affects index usage? In-reply-to: <004301cda8b4$fdc57bd0$f9507370$@devshock.com> References: <004301cda8b4$fdc57bd0$f9507370$@devshock.com> Comments: In-reply-to "Anibal David Acosta" message dated "Fri, 12 Oct 2012 17:05:52 -0300" Date: Fri, 12 Oct 2012 16:38:31 -0400 Message-ID: <21823.1350074311@sss.pgh.pa.us> X-Pg-Spam-Score: -4.0 (----) X-Archive-Number: 201210/165 X-Sequence-Number: 48124 "Anibal David Acosta" 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