Indexes with different datatypes - Mailing list pgsql-performance

From Cecilia Alvarez
Subject Indexes with different datatypes
Date
Msg-id Law12-F42ggtxEx4H1e00004b00@hotmail.com
Whole thread Raw
List pgsql-performance
<div style="background-color:"><p><font face="Geneva, Arial, Sans-serif" size="2">Hi,</font><p><font face="Geneva,
Arial,Sans-serif" size="2">I´ve already created an concatenated index in Postgres V3.0 with different
datatypes:</font><p><fontface="Geneva, Arial, Sans-serif"><font size="2"><font color="#0000ff">CREATE</font> <font
color="#ff0000">INDEX</font>mov_i4 <font color="#008000">ON</font> movimiento <font color="#008000">USING</font> btree
(id_company,id_status, id_docum, id_origen_mov);</font></font><p><font face="Geneva, Arial, Sans-serif"
size="2">id_companyint2</font><p><font face="Geneva, Arial, Sans-serif" size="2">id_status char(1)</font><p><font
face="Geneva,Arial, Sans-serif" size="2">id_docum numeric(15,0)</font><p><font face="Geneva, Arial, Sans-serif"
size="2">id_origen_movint4</font><p><font face="Geneva, Arial, Sans-serif" size="2">and after several tests the query
doesn´tuse the index because it seems that id_company must be a char.</font><p><font face="Geneva, Arial, Sans-serif"
size="2">Ifa use the value for the id_company eg.   select * from movimiento where id_company = <font
color="#ff0000">120</font></font><p><fontface="Geneva, Arial, Sans-serif"
size="2">                                                          andid_status = 'X' and id_docto = 10000056789 and
mount= 12345.56</font><p><font face="Geneva, Arial, Sans-serif" size="2">---- it doesn´t use the
index                                                                               </font><p><font face="Geneva,
Arial,Sans-serif" size="2">If a use the value for the id_company eg.   select * from movimiento where id_company =
<fontcolor="#ff0066">'120' </font>and</font><p><font face="Geneva, Arial, Sans-serif"
size="2">                                                     andid_status = 'X' and id_docto = 10000056789 and mount =
12345.56</font><p><fontface="Geneva, Arial, Sans-serif" size="2">---- it  uses the index</font><p> <p><font
face="Geneva,Arial, Sans-serif" size="2">The problem is that I can´t change the datatypes in the hole application and
thetable has 240,000 rows and we need to use concatenated indexes, because we access the table in different ways, the
tablehas another five concatenated indexes.</font><p><font face="Arial" size="2">Could you suggest something to resolve
this?</font><p><fontface="Arial" size="2">Thank you very much.</font><p><font face="Arial"
size="2">Regards,</font><p><fontface="Arial" size="2">Cecilia</font><p> <div> </div></div><br clear="all" /><hr />Únete
almayor servicio mundial de correo electrónico: <a href="http://g.msn.com/8HMWESMX/2755">Haz clic aquí </a> 

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: More tablescanning fun
Next
From: "Cecilia Alvarez"
Date:
Subject: Indexes with different datatypes:Correction