pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexaki Sofia <alexaki@ics.forth.gr>
To: pgsql-sql@postgresql.org
Subject: A question about indexes...
Date: Thu, 3 Aug 2000 20:51:44 +0300 (EET DST)
Message-ID: <Pine.GSO.4.10.10008032023500.25089-100000@sappho.ics.forth.gr> (raw)

Hello,
 
I have the  following tables in my db
 
Painter (id integer,  uri varchar(256)) and
paints (id1 integer, id2 integer)
 
I  want to optimize the question
   select id from Painter where uri = 'xxxxx';
 
 What kind of index (Btree or Hash) is more efficient to create on field
uri  since it's a string?
 
I also want  to optimize the join between the ables Painter and paints 
on the fields id and id1 respectively?
I can either define the field id as a Primary Key or create an Btree index
on it. What is more effient?? 
From  my test I see that creating  Btree index is  a bit faster!!. 
 
Would the performance (of the join) be  improved if  I created indexes
both on field id and id1 or it's sufficient  to create one of the two
indexes ?
As far as I can see the performance is improved if I have a Primary Key on
Painter.id and a BTree index on paints.id1. However when I create a 
Btree index on Painter.id and a BTree index on paints.id1 performance
gets worst.


thank you in advance for your help
 
Sofia Alexaki
alexaki@ics.forth.gr




view thread (4+ messages)  latest in thread

Message-ID: <Pine.GSO.4.10.10008032023500.25089-100000@sappho.ics.forth.gr>
Permalink:  ../Pine.GSO.4.10.10008032023500.25089-100000@sappho.ics.forth.gr/
Also on:    postgresql.org/message-id/Pine.GSO.4.10.10008032023500.25089-100000@sappho.ics.forth.gr

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: alexaki@ics.forth.gr
  Subject: Re: A question about indexes...
  In-Reply-To: <Pine.GSO.4.10.10008032023500.25089-100000@sappho.ics.forth.gr>
  References: <Pine.GSO.4.10.10008032023500.25089-100000@sappho.ics.forth.gr>

* 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