X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C375D3A4884 for ; Wed, 1 Dec 2004 19:27:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34179-04 for ; Wed, 1 Dec 2004 19:26:56 +0000 (GMT) Received: from rot.tecsoft.com.br (200.175.61.22.tbprof.gvt.net.br [200.175.61.22]) by svr1.postgresql.org (Postfix) with ESMTP id B0BCC3A44B5 for ; Wed, 1 Dec 2004 19:26:55 +0000 (GMT) Received: (from root@localhost) by rot.tecsoft.com.br (8.12.10/8.12.10) id iB1JQqgW003757 for pgsql-sql@postgresql.org; Wed, 1 Dec 2004 19:26:52 GMT Received: from [192.168.2.101] ([192.168.2.101]) by rot.tecsoft.com.br (8.12.10/8.12.10) with ESMTP id iB1JQoqL003717 for ; Wed, 1 Dec 2004 19:26:50 GMT Message-ID: <41AE1B03.50205@tecsoft.com.br> Date: Wed, 01 Dec 2004 17:26:59 -0200 From: Sandro Joel Eller Organization: TecSoft Tecnologia User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PGSQL Subject: Query is slower Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-scanner: scanned by Inflex 1.0.12.7 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200412/6 X-Sequence-Number: 19626 Hi I have a query using "like" operator (select * from name like 'JOHN%'), but the table has about 500 hundred records. The has a index (create index ixcontract_name on contract (name)) , but it is very slow because it is not using index. How do I do the query to use index? Sandro -- *Sandro Joel Eller* Analista/Programador Senior www.tecsoft.com.br sandro@tecsoft.com.br