Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id CD36C633109 for ; Thu, 1 Apr 2010 15:51:11 -0300 (ADT) 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 81337-09 for ; Thu, 1 Apr 2010 18:51:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.152]) by mail.postgresql.org (Postfix) with ESMTP id 36025632BF4 for ; Thu, 1 Apr 2010 15:51:01 -0300 (ADT) Received: by fg-out-1718.google.com with SMTP id 19so882200fgg.1 for ; Thu, 01 Apr 2010 11:50:59 -0700 (PDT) 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:received:message-id:subject:from:to:cc:content-type; bh=PXnvsCPF8iv5U83+Y22SknQuMnuRESMpF4g0U2+1O74=; b=kYWzcyJfIpacfXFlDqKBCzdrIitEDm6IdITDexP2fNWMJS3tLm+pGkAynrThjVJBZ7 miE9lefhWAN9Sc4dEx7F0+fQNvvOK15VF+sGXlSwgrreVnVXKB4r9pg0FK+mV6UcQaz+ AajzvXSfUTjpx8dWoaXrOOVMtq2n8muMJeohw= 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=c2DEO7ZVlEbn/5YyxGi9F909DRKJ0VJXZoruqGCnC+Z7/pu/Qu6Y+JLTB5Z4X9W6Gf fCtRSZ6vhzdir5UyfA9LBRc0WzLBCFfALlVQ4urDtw6FgqO90CjvaI8EtkBALs8QWCXJ AmaKerVEeLDM0kWVrnwhVsmwCQR9fV2Gdmhvc= MIME-Version: 1.0 Received: by 10.239.161.83 with HTTP; Thu, 1 Apr 2010 11:50:59 -0700 (PDT) In-Reply-To: References: <603c8f071003291102g778afc2fvda0fc281454526c9@mail.gmail.com> <4BB1DB9A020000250003020E@gw.wicourts.gov> <603c8f071003301259u140d8556vc54ff46855013bd3@mail.gmail.com> Date: Thu, 1 Apr 2010 14:50:59 -0400 Received: by 10.239.190.74 with SMTP id w10mr84230hbh.180.1270147859633; Thu, 01 Apr 2010 11:50:59 -0700 (PDT) Message-ID: Subject: Re: experiments in query optimization From: Robert Haas To: Faheem Mitha Cc: Eliot Gable , Kevin Grittner , pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.284 tagged_above=-10 required=5 tests=BAYES_00=-2.599, SARE_MILLIONSOF=0.315 X-Spam-Level: X-Archive-Number: 201004/11 X-Sequence-Number: 38261 On Thu, Apr 1, 2010 at 2:15 PM, Faheem Mitha wrote: > I had set the foreign keys in question (on the geno table) to be primary > keys. This is because this setup is basically a glorified spreadsheet, and I > don't want more than one cell corresponding to a particular tuple of > idlink.id and anno.id (the conceptual rows and cols). Since a primary key > defines an index, I thought putting indexes on idlink_id and anno_id was > redundant. However, it looks like (unsurprisingly) the index corresponding > to the primary key is across both columns, which may not be what is wanted > for the aforesaid join Actually it is what is wanted - that is good. > So, should I add indexes on the individual foreign key cols idlink_id > and anno_id after all? I doubt that would help. The bottom line may be that you're dealing with hundreds of millions of rows here, so things are going to take a long time. Of course you can always get more/faster memory, a bigger I/O subsystem, faster processors... and it could be that with detailed study there are optimizations that could be done even without spending money, but I think I'm about tapped out on what I can do over an Internet mailing list. ...Robert