A question about indexes... - Mailing list pgsql-sql

From Alexaki Sofia
Subject A question about indexes...
Date
Msg-id Pine.GSO.4.10.10008032023500.25089-100000@sappho.ics.forth.gr
Whole thread Raw
Responses Re: A question about indexes...  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
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
efficientto 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



pgsql-sql by date:

Previous
From: Mark Volpe
Date:
Subject: Re: SQL (table transposition)
Next
From: John McKown
Date:
Subject: Re: Extracting data by months