Re: Index type

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Algolist <algolist(at)manual(dot)ru>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Index type
Date: 2004-08-16 23:16:27
Message-ID: 200408161616.27768.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

In response to

  • Index type at 2004-07-20 21:46:11 from Ilia Kantor

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2004-08-16 23:25:41 Re: Timestamp-based indexing
Previous Message Josh Berkus 2004-08-16 23:09:13 Re: Timestamp-based indexing