pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ilia Kantor <algolist@manual.ru>
To: pgsql-performance@postgresql.org
Subject: Index type
Date: Wed, 21 Jul 2004 01:46:11 +0400
Message-ID: <418482301.20040721014611@manual.ru> (raw)
In-Reply-To: <20040626222142.5E3D75AF09D@svr4.postgresql.org>
References: <20040626222142.5E3D75AF09D@svr4.postgresql.org>

Hello,

I have a request like SELECT ... WHERE x<=A<=y AND t<=B<=u AND z<=C<=w AND ..
5 columns are in BETWEEN clauses.

What is the best index I could use?

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))


Is such search really optimal?

I remember we used k-d trees for geometric data with independent
coords.. Is that the same as btree for multiple columns I wonder.



-- 
Best regards,
 Ilia                            mailto:algolist@manual.ru




view thread (2+ messages)  latest in thread

Message-ID: <418482301.20040721014611@manual.ru>
Permalink:  ../418482301.20040721014611@manual.ru/
Also on:    postgresql.org/message-id/418482301.20040721014611@manual.ru

 · 

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: algolist@manual.ru
  Subject: Re: Index type
  In-Reply-To: <418482301.20040721014611@manual.ru>

* 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