Received: from mail.tgd.net (pop3-ssl.tgd.net [209.81.25.10]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g081rSB41845 for ; Mon, 7 Jan 2002 20:53:28 -0500 (EST) (envelope-from sean@mail.tgd.net) Received: by mail.tgd.net (Postfix, from userid 1001) id 50D3820F13; Mon, 7 Jan 2002 17:53:21 -0800 (PST) Date: Mon, 7 Jan 2002 17:53:21 -0800 From: Sean Chittenden Cc: Daniel Kalchev , pgsql-hackers@postgresql.org Subject: Re: again on index usage Message-ID: <20020107175321.C67695@ninja1.internal> References: <200201071841.UAA26328@dcave.digsys.bg> <14149.1010432467@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <14149.1010432467@sss.pgh.pa.us>; from "tgl@sss.pgh.pa.us" on Mon, Jan 07, 2002 at = 02:41:07PM X-PGP-Key: 0x1EDDFAAD X-PGP-Fingerprint: C665 A17F 9A56 286C 5CFB 1DEA 9F4F 5CEF 1EDD FAAD X-Web-Homepage: http://sean.chittenden.org/ X-Archive-Number: 200201/298 X-Sequence-Number: 17351 > It's difficult to tell from this what it thinks the selectivity of the > ipdate index would be, since the rows estimate includes the effect of > the ipaddr and router restrictions. What do you get from just > > explain > SELECT sum(input) FROM iplog_gate200112 > WHERE > '2001-12-01 00:00:00+02' <= ipdate AND ipdate < '2001-12-02 00:00:00+02' AND > '2001-12-01 00:00:00+02' <= ipdate AND ipdate < '2002-01-01 00:00:00+02'; > I don't know if this'd help, but if you're suming the data and running this query often, see if a function index would help: CREATE INDEX sum_input_fnc_idx ON iplog_gate200112 (sum(input)); -sc -- Sean Chittenden