X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2BD8E4762BB for ; Thu, 17 Apr 2003 14:13:56 -0400 (EDT) Received: from mta5.snet.net (mta5.snet.net [204.60.203.77]) by postgresql.org (Postfix) with ESMTP id 453064762A2 for ; Thu, 17 Apr 2003 14:13:43 -0400 (EDT) Received: from pop.snet.net (pop.snet.net [204.60.203.72]) by mta5.snet.net (8.12.3/8.12.3/SNET-mx-1.2/D-1.1.1.1/O-1.1.1.1) with ESMTP id h3HIDFvw007976; Thu, 17 Apr 2003 14:13:15 -0400 (EDT) X-Originating-IP: [64.252.95.167] X-SBCIS-MTA: [pop.snet.net] Received: from kencast.com (167.95.252.64.snet.net [64.252.95.167]) by pop.snet.net (8.12.3/8.12.3/SNET-pop-1.2/D-1.1.1.1/O-1.1.1.1) with ESMTP id h3HID2me022971; Thu, 17 Apr 2003 14:13:15 -0400 (EDT) Message-ID: <3E9EF2C3.2000705@kencast.com> Date: Thu, 17 Apr 2003 14:30:27 -0400 From: Wei Weng User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en, zh-cn MIME-Version: 1.0 To: maggon@newgen.co.in Cc: pgsql-sql@postgresql.org Subject: Re: IN Qeury Problem References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-38.8 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_MOZILLA_UA autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/285 X-Sequence-Number: 12986 What about this? Put all those integers into a table called TempData CREATE TABLE TempData ( datavalue INTEGER; ); CREATE INDEX ind_tempdata ON TEMPDATA (datavalue); Then you can use query SELECT * FROM FolderTable as ft, TempData as td WHERE ft.ParentFolderIndex = td.datavalue; IN query's performance has been notoriously bad in PostgreSQL implementation, try to avoid it. Regards, Wei Sameer Maggon wrote: >Hello, > > I am facing a problem regarding the performance of postgres. I am >concerned about the speed of the execution of a query when large number of >entries is given in the IN clause. > >I have a Table with columns: > >FolderName (Indexed) >FolderIndex (Indexed) >ParentFolderIndex (Indexed) >... >.. > >I have a query where i do a SELECT > >SELECT * FROM FolderTable WHERE PARENTFOLDERINDEX IN (38::int8, ......); > >If the number of values in IN clause is small, its working fine, but as and >when the number of values increases the speed of the query is detoriating >with a steep curve. > >How can this problem be solved ? > >Thanks and Regards >Sameer Maggon > > >---------------------------(end of broadcast)--------------------------- >TIP 6: Have you searched our list archives? > >http://archives.postgresql.org > > > >