Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id E1C179FB298 for ; Fri, 12 Jan 2007 04:16:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 20094-09 for ; Fri, 12 Jan 2007 04:16:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from lynet.oppetid.no (oppetid.no [80.65.51.2]) by postgresql.org (Postfix) with ESMTP id 8C35B9FA304 for ; Fri, 12 Jan 2007 04:16:35 -0400 (AST) Received: by lynet.oppetid.no (Postfix, from userid 1019) id 5090C11A365; Fri, 12 Jan 2007 09:16:31 +0100 (CET) Date: Fri, 12 Jan 2007 09:16:31 +0100 From: Tobias Brox To: pgsql-performance@postgresql.org Subject: Planner statistics, correlations Message-ID: <20070112081631.GA10636@oppetid.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Organization: Group Nordicbet User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/197 X-Sequence-Number: 22798 We have a table with a timestamp attribute (event_time) and a state flag which usually changes value around the event_time (it goes to 4). Now we have more than two years of events in the database, and around 5k of future events. It is important to frequently pick out "overdue events", say: select * from events where state<>4 and event_time4 has event_time