Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id A93D517A222 for ; Thu, 9 Feb 2012 15:46:21 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RvZwi-0005Bs-7N for pgsql-performance@postgresql.org; Thu, 09 Feb 2012 19:46:21 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q19Jk6Vv027574; Thu, 9 Feb 2012 14:46:06 -0500 (EST) To: Alessandro Gagliardi cc: pgsql-performance@postgresql.org Subject: Re: timestamp with time zone In-reply-to: References: Comments: In-reply-to Alessandro Gagliardi message dated "Thu, 09 Feb 2012 10:42:15 -0800" Date: Thu, 09 Feb 2012 14:46:06 -0500 Message-ID: <27573.1328816766@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201202/77 X-Sequence-Number: 46249 Alessandro Gagliardi writes: > WHERE ... (created at time zone timezone)::date = 'yesterday' > created has an index (btree if it matters). timezone does not. I'm > wondering if the solution to my problem is to create a joint index between > created and timezone (and if so, if there is a particular way to do that to > make it work the way I want). The only way to make that indexable is to create an expression index on the whole expression "(created at time zone timezone)::date". Seems pretty special-purpose, though it might be worthwhile if you do that a lot. regards, tom lane