Re: again on index usage - Mailing list pgsql-hackers

From Sean Chittenden
Subject Re: again on index usage
Date
Msg-id 20020107175321.C67695@ninja1.internal
Whole thread Raw
In response to Re: again on index usage  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> 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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: ecpg compile error on AIX
Next
From: Bruce Momjian
Date:
Subject: Re: ecpg compile error on AIX