Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TMlUe-0001TN-Ur for pgsql-performance@postgresql.org; Fri, 12 Oct 2012 20:06:01 +0000 Received: from mail-gg0-f174.google.com ([209.85.161.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TMlUa-0002GD-MH for pgsql-performance@postgresql.org; Fri, 12 Oct 2012 20:06:00 +0000 Received: by mail-gg0-f174.google.com with SMTP id k5so875425ggd.19 for ; Fri, 12 Oct 2012 13:05:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type:x-mailer :thread-index:content-language:x-gm-message-state; bh=e7qr0Pq1svd508Y3PMxUI2qJhAd5UKSfmnSFZ7WFakg=; b=X4o6tJAfnPxH+CRc94s/GO86Ytq1SpW1wx1TzB9NwDWkKxnDfDZgJS95OCDIEsv7kb H8EW+2B0iPsVqblPquYtZSiJfFiC9P9O+UcaTNZSCeJdct/HaIlWNKxA7meBM9Yy3CDE eCHpTySrCXwCZ1lL98VYSzZB4IZRFAxWDwIEPJf40w4ZAGliA3p8gDm4iyR1zS/exsKc totXMRzkrHT0QNSkEw2jI4SUmhMHLQxP/t5/8ZUe0v0hqfysj2ELIm8TktObZxYwVY1p EpY+H8jGrSpRLlvn/AG6/9CcIIh3AsRG8OpnqucvncmXN7NdV4anNavWrp4XjRm7feSw htcw== Received: by 10.236.193.71 with SMTP id j47mr5190432yhn.79.1350072355448; Fri, 12 Oct 2012 13:05:55 -0700 (PDT) Received: from AnibalVAIO ([190.128.222.90]) by mx.google.com with ESMTPS id u13sm7356286anl.5.2012.10.12.13.05.52 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 12 Oct 2012 13:05:54 -0700 (PDT) From: "Anibal David Acosta" To: Subject: Do cast affects index usage? Date: Fri, 12 Oct 2012 17:05:52 -0300 Message-ID: <004301cda8b4$fdc57bd0$f9507370$@devshock.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0044_01CDA89B.D878B900" X-Mailer: Microsoft Outlook 14.0 Thread-Index: Ac2osay1BwMecW6/SEO8RW9fhAm0qA== Content-Language: es-py X-Gm-Message-State: ALoCoQnf4vyg/vztFeBpSO1PYO+Mg9GumJZ+0pQI9zRUWEZu14IZIQQ2SnB7jHcacfkeGzfzL6oE X-Pg-Spam-Score: -1.2 (-) X-Archive-Number: 201210/163 X-Sequence-Number: 48122 This is a multipart message in MIME format. ------=_NextPart_000_0044_01CDA89B.D878B900 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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? Thanks ------=_NextPart_000_0044_01CDA89B.D878B900 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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?

 

Thanks

 

------=_NextPart_000_0044_01CDA89B.D878B900--