pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Algolist <algolist@manual.ru>
Cc: pgsql-performance@postgresql.org
Subject: Re: Index type
Date: Mon, 16 Aug 2004 16:16:27 -0700
Message-ID: <200408161616.27768.josh@agliodbs.com> (raw)
In-Reply-To: <418482301.20040721014611@manual.ru>
References: <20040626222142.5E3D75AF09D@svr4.postgresql.org>
	<418482301.20040721014611@manual.ru>

Ilia,

> If I create btree index on all columns (A,B,C..), here is what explain
> analyze gives me:
> -----------------------------------------------------------------
>  Index Scan using all_ind on test2  (cost=0.00..4.51 rows=1 width=24)
> (actual ti me=0.000..0.000 rows=5 loops=1)
>    Index Cond: ((a >= '2004-07-20 23:50:50'::timestamp without time zone)
> AND (a <= '2004-07-21 23:50:50'::timestamp without time zone) AND (b >=
> '2004-07-20 23
>
> :50:50'::timestamp without time zone) AND (b <= '2004-07-21
> : 23:50:50'::timestamp
>
>  without time zone) AND (c >= '2004-07-20 23:50:50'::timestamp without time
> zone ) AND (c <= '2004-07-21 23:50:50'::timestamp without time zone))

Looks good to me.   It's a fully indexed search, which it should be with 
BETWEEN.  The only thing you need to ask yourself is whether or not you've 
selected the columns in the most selective order (e.g. most selective column 
first).

-- 
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco



view thread (2+ messages)

Message-ID: <200408161616.27768.josh@agliodbs.com>
Permalink:  ../200408161616.27768.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200408161616.27768.josh@agliodbs.com

 · 

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-performance@postgresql.org
  Cc: josh@agliodbs.com, algolist@manual.ru
  Subject: Re: Index type
  In-Reply-To: <200408161616.27768.josh@agliodbs.com>

* 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