X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 06693D1B481 for ; Thu, 29 Jan 2004 22:08:11 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 41382-06 for ; Thu, 29 Jan 2004 18:07:42 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id C7912D1B47D for ; Thu, 29 Jan 2004 18:07:39 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i0TM7XH8028617; Thu, 29 Jan 2004 17:07:33 -0500 (EST) To: Richard Huxton Cc: lnd@hnit.is, pgsql-performance@postgresql.org Subject: Re: Explain plan for 2 column index In-reply-to: <200401292137.16750.dev@archonet.com> References: <0A5B2E3C3A64CA4AB14F76DBCA76DDA44EF9B4@seifur.hnit.is> <200401292137.16750.dev@archonet.com> Comments: In-reply-to Richard Huxton message dated "Thu, 29 Jan 2004 21:37:16 +0000" Date: Thu, 29 Jan 2004 17:07:33 -0500 Message-ID: <28616.1075414053@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/312 X-Sequence-Number: 5486 Richard Huxton writes: >> Index Scan using testtab_name_date_from on testtab (cost=0.00..2.01 >> rows=1 width=18) >> Index Cond: ((name)::text = 'name1'::text) >> Filter: ((date_from)::timestamp with time zone = >> ('now'::text)::timestamp(6)with time zone) > What types are the columns here? If date_from isn't timestamp with time zone, > that might be the issue. It clearly isn't, since we can see a coercion to timestamp with time zone in the query. My guess is that the original SQL was WHERE ... date_from = current_timestamp This should be WHERE ... date_from = localtimestamp if timestamp without tz is the intended column datatype. Of course, it might just be that date_from was declared as the wrong type (it really sucks that SQL specifies "timestamp" to default to "without time zone" ...) regards, tom lane