Indexes with different datatypes:Correction - Mailing list pgsql-performance

From Cecilia Alvarez
Subject Indexes with different datatypes:Correction
Date
Msg-id Law12-F28Ua8d9Ee4za00004f04@hotmail.com
Whole thread Raw
Responses Re: Indexes with different datatypes:Correction
List pgsql-performance
<div style="background-color:"><div><p><br /><br /><div><p><font face="Arial" size="2">Sorry, this is the good
one:</font></div><p><fontface="Geneva, Arial, Sans-serif" size="2">I´ve already created an concatenated index in
PostgresV3.0 with different datatypes:</font></div><p><font face="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><div></div><p><font
face="Geneva,Arial, Sans-serif" size="2">id_company int2</font><div></div><p><font face="Geneva, Arial, Sans-serif"
size="2">id_statuschar(1)</font><div></div><p><font face="Geneva, Arial, Sans-serif" size="2">id_docum
numeric(15,0)</font><div></div><p><fontface="Geneva, Arial, Sans-serif" size="2">id_origen_mov
int4</font><div></div><p><fontface="Geneva, Arial, Sans-serif" size="2">and after several tests the query doesn´t use
theindex because it seems that id_company must be a char.</font><div></div><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><div></div><p><fontface="Geneva, Arial, Sans-serif"
size="2">                                                          andid_status = 'X' and id_docum = 10000056789
and id_origen_mov= 12345</font><div></div><p><font face="Geneva, Arial, Sans-serif" size="2">---- it doesn´t use the
index                                                                               </font><div></div><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= <font color="#ff0066">'120' </font>and</font><div></div><p><font face="Geneva, Arial, Sans-serif"
size="2">                                                     andid_status = 'X' and id_docum = 10000056789
and id_origen_mov= 12345</font><div></div><p><font face="Geneva, Arial, Sans-serif" size="2">---- it  uses the
index</font><div></div><p> <div></div><p><fontface="Geneva, Arial, Sans-serif" size="2">The problem is that I can´t
changethe datatypes in the hole application and the table has 240,000 rows and we need to use concatenated indexes,
becausewe access the table in different ways, the table has another five concatenated
indexes.</font><div></div><p><fontface="Arial" size="2">Could you suggest something to resolve
this?</font><div></div><p><fontface="Arial" size="2">Thank you very much.</font><div></div><p><font face="Arial"
size="2">Regards,</font><div></div><p><fontface="Arial"
size="2">Cecilia</font><div></div><p> <div></div><div> </div><div></div></div><brclear="all" /><hr />MSN. Más Útil Cada
Día<a href="http://g.msn.com/8HMWESMX/2737">Haz clic aquí </a> smart spam protection and 2 months FREE*  

pgsql-performance by date:

Previous
From: "Cecilia Alvarez"
Date:
Subject: Indexes with different datatypes
Next
From: "scott.marlowe"
Date:
Subject: Re: Indexes with different datatypes:Correction