Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 72445632B35 for ; Sun, 31 Jan 2010 20:55:07 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 23536-08 for ; Mon, 1 Feb 2010 00:54:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ew0-f219.google.com (mail-ew0-f219.google.com [209.85.219.219]) by mail.postgresql.org (Postfix) with ESMTP id C936C63290A for ; Sun, 31 Jan 2010 20:54:56 -0400 (AST) Received: by ewy19 with SMTP id 19so1865458ewy.21 for ; Sun, 31 Jan 2010 16:54:54 -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=OtxYJINmO54Tr89vgnWgu6jf2ZvJZ9l4lE/+6uDPej4=; b=mtqsi5c4UMxNXgl5Hdb40f81tKtpjngHbckwhfdjnKxtea0zVmvqeqcbAVXGLdbNwK BIIq6+k8DRGQNGsmnxVgR56knRczbKI7lpcbsMyPE4NoDoSQKaKA+LLP83rAhBHAYB5Y FcmXDT37slGPA4/ojAAqb/ogdkl2XvAm1QKE4= 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=fKFXoM4rq+Z6i8pOfZdWQlplKXrLXg3t4Dr9uZOSLUfrWl8SOVZXwCA1QSWX5iwqKn MoDJo46U5WjlBh4/i76UwxsAAbliBaBrLF937bZmR7I2kHkWxFtG89/RACWmh9efnh8t apTbt3q9TuzYwjR4jcEF3QUQUAWmXP6T+YB3A= MIME-Version: 1.0 Received: by 10.216.90.11 with SMTP id d11mr1976489wef.187.1264985691477; Sun, 31 Jan 2010 16:54:51 -0800 (PST) In-Reply-To: <1f30b80c1001311650q264dfda0uf9894cac3b9e0c3e@mail.gmail.com> References: <1f30b80c1001290049ub864091r8298fca3daa0eb69@mail.gmail.com> <1f30b80c1001311650q264dfda0uf9894cac3b9e0c3e@mail.gmail.com> Date: Sun, 31 Jan 2010 17:54:51 -0700 Message-ID: Subject: Re: Fwd: Help required on query performance From: Scott Marlowe To: dclements89@gmail.com Cc: pgsql-sql Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201001/57 X-Sequence-Number: 33593 On Sun, Jan 31, 2010 at 5:50 PM, Dave Clements wrote: > Hello, I have this query in my system which takes around 2.5 seconds > to run. I have diagnosed that the problem is actually a hashjoin on > perm and s_ast_role tables. Is there a way I can avoid that join? I > just want to change the > query and no environment change. What does explain analyze select ... (rest of your query) say?