Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 958A06331CB for ; Tue, 2 Feb 2010 19:39:55 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 22546-08 for ; Tue, 2 Feb 2010 23:39:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ew0-f222.google.com (mail-ew0-f222.google.com [209.85.219.222]) by mail.postgresql.org (Postfix) with ESMTP id BE100632D3A for ; Tue, 2 Feb 2010 19:39:44 -0400 (AST) Received: by ewy22 with SMTP id 22so115476ewy.34 for ; Tue, 02 Feb 2010 15:39:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=w59yTLmi1DEIWmMRXBQrV5cQXJZWrfrW5jeMbZrJPnk=; b=R6b9VyzUvgRWd9T6FqFCtbUFHgTK/B0+UAUFi7qoSQj9a1oMV4c2vkFNly+3UlsDhj +SVyMA29LCVO2loSOYLSmbiUI6Jd05sxTUMy0zbKeMyquHYu0DGQslZ0lEKoBd/ayLfl K13lBIeiv2bC9hCe4f0PN0msyauZGQE1dluQ0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=pSOFO7EoO0y23OVo/mSkTAKHeEVA+aWL8i9JCwpySGl02Rvft5PuLDI/L7HLsMUhQh w6C6yRIV7BWiaHewtQ81FeaLCNYyRfgJrJrDiTMUXQav4tr5Wr8sgwPZC7beOoJrSNX/ K5wlekJ9JeyszZh7MqEQ4oEEcNoGJGH02Hfhg= MIME-Version: 1.0 Received: by 10.216.91.10 with SMTP id g10mr3115604wef.217.1265153982473; Tue, 02 Feb 2010 15:39:42 -0800 (PST) In-Reply-To: References: Date: Tue, 2 Feb 2010 16:39:42 -0700 Message-ID: Subject: Re: How to increase postgresql performance From: Scott Marlowe To: fida aljounaidi Cc: pgsql-admin@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.483 tagged_above=-10 required=5 tests=AWL=0.116, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/33 X-Sequence-Number: 33636 On Tue, Feb 2, 2010 at 3:51 AM, fida aljounaidi wrote: > Hi > > I have an sql query which takes 20 seconds to be executed. > > this sql query contain more than 870 id under the select where in () > condition. > > So , it is not a large row result but a big list of conditions to be > crossed. > > I'm using postgresql 8.4. In addition to the things already posted, post your query and the output of explain analyze yourquery to the list and let us have a look.