X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 18A5C475F2C for ; Fri, 31 Jan 2003 11:04:38 -0500 (EST) Received: from termit.gingerall.cz (termit.gingerall.cz [212.24.153.2]) by postgresql.org (Postfix) with ESMTP id DF8AC475DA7 for ; Fri, 31 Jan 2003 11:04:35 -0500 (EST) Received: from gingerall.cz (IDENT:9Dhmd97CYImEVFqM/+xbAWwINADBbanx@angrest.gingerall.cz [212.24.153.10]) by termit.gingerall.cz (8.11.2/8.11.6) with ESMTP id h0VG3Le28866; Fri, 31 Jan 2003 17:03:22 +0100 Message-ID: <3E3A9E49.1090503@gingerall.cz> Date: Fri, 31 Jan 2003 17:03:21 +0100 From: Pavel Hlavnicka User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2) Gecko/20021203 X-Accept-Language: en, cs MIME-Version: 1.0 To: pgsql-sql@postgresql.org Cc: Tom Lane Subject: Re: calculated expressions and index use References: <3E394AA6.8080400@gingerall.cz> <20100.1043945485@sss.pgh.pa.us> <3E3A3757.3040906@gingerall.cz> <8577.1044024965@sss.pgh.pa.us> In-Reply-To: <8577.1044024965@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/523 X-Sequence-Number: 11388 Yes, you are right. It was an issue reated to the type compatibility. My braindead script created tables with 'datetime' types, what is 'timestamp without time zone' after I switched to 'timestamp', all works fine. Thanks a loc, the fact, you ensured me, that the constant expression should be recognized, pushed me much further. Thanks again Have a nice day Pavel Tom Lane wrote: > Pavel Hlavnicka writes: > >>I use 7.2.1. :( > > > 7.2 certainly will fold "'now'::timestamp - '1 hour'::interval" to a > timestamp constant. This could be a datatype compatibility issue > (is created_at the same type? in particular, with/without time zone?) > or it could be a selectivity issue --- ie, the planner might think the > condition covers too much of the table to make the index useful. > > It would be useful to look at the results of EXPLAIN ANALYZE for this > query, with and without ENABLE_SEQSCAN turned off. > > regards, tom lane -- Pavel Hlavnicka Ginger Alliance www.gingerall.com