pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sean Chittenden <sean@chittenden.org>
Cc: Daniel Kalchev <daniel@digsys.bg>
Cc: pgsql-hackers@postgresql.org
Subject: Re: again on index usage
Date: Mon, 7 Jan 2002 17:53:21 -0800
Message-ID: <20020107175321.C67695@ninja1.internal> (raw)
In-Reply-To: <14149.1010432467@sss.pgh.pa.us>
References: <200201071841.UAA26328@dcave.digsys.bg>
	<14149.1010432467@sss.pgh.pa.us>

> 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



view thread (48+ messages)  latest in thread

Message-ID: <20020107175321.C67695@ninja1.internal>
Permalink:  ../20020107175321.C67695@ninja1.internal/
Also on:    postgresql.org/message-id/20020107175321.C67695@ninja1.internal

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: sean@chittenden.org, daniel@digsys.bg
  Subject: Re: again on index usage
  In-Reply-To: <20020107175321.C67695@ninja1.internal>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox