Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TMpa2-0005ON-AT for pgsql-performance@postgresql.org; Sat, 13 Oct 2012 00:27:50 +0000 Received: from mail-gh0-f174.google.com ([209.85.160.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TMpZx-0005uk-2C for pgsql-performance@postgresql.org; Sat, 13 Oct 2012 00:27:48 +0000 Received: by mail-gh0-f174.google.com with SMTP id g15so942442ghb.19 for ; Fri, 12 Oct 2012 17:27:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-type:content-transfer-encoding:x-mailer :thread-index:content-language:x-gm-message-state; bh=Z63chmj+20P0UVSzBJ6xz5UtylixJxDudtiX2ilQYiE=; b=SwSRD5azST/K070LJu14IeAvMC+HpltFxouQi7WgybtObx8pKQGJ8m2Rf3vs9N/j9G UPZlOxCX8kiR8x4XYgPnLOIyd3i3pu5v41x9qOTYBpuz0K6MTeOzA0y0HOXp2Fuw4t87 jHUkQq+dE5+DSg8dVE9R9j1BRjJDuCxVPHraMojwsBhP9Xeie+7g26JUoSY+5y5+z+Aj FUfELbEgpV/gxxn2oQoy3u9PpHHnr1/6gkU0ZdqS7ShVPHGExMnZK4lJnSnKQ3Ih4gOd nex0yZzq0MtYgC7gmm5bRRD+bZIc2fdQf7sMZEZeXQq6iq2PDUqPk7lqsyzfVLtE1HCN a4RA== Received: by 10.101.175.34 with SMTP id c34mr1816866anp.0.1350088064000; Fri, 12 Oct 2012 17:27:44 -0700 (PDT) Received: from AnibalVAIO (host-1-86.b20.cvc.com.py. [186.2.211.86]) by mx.google.com with ESMTPS id e65sm6651586yhc.18.2012.10.12.17.27.42 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 12 Oct 2012 17:27:43 -0700 (PDT) From: "Anibal David Acosta" To: "'Tom Lane'" Cc: References: <004301cda8b4$fdc57bd0$f9507370$@devshock.com> <21823.1350074311@sss.pgh.pa.us> In-Reply-To: <21823.1350074311@sss.pgh.pa.us> Subject: Re: Do cast affects index usage? Date: Fri, 12 Oct 2012 21:27:42 -0300 Message-ID: <000001cda8d9$913a7770$b3af6650$@devshock.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQGT57XVKrcJB9MlNPDc4DRfzfgK1QD/vCnUmCHi5LA= Content-Language: es-py X-Gm-Message-State: ALoCoQlgHExKh5fw2MWpMvBFbSAMR2IJZMz3IhUX0SapvWnGbu6q064kIh07TW0Qjt0xOQ747yyu X-Pg-Spam-Score: -0.9 (/) X-Archive-Number: 201210/170 X-Sequence-Number: 48129 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" 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