Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UOU10-0003uo-Pz for pgsql-performance@arkaria.postgresql.org; Sat, 06 Apr 2013 14:22:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UOU10-0000Z8-2l for pgsql-performance@arkaria.postgresql.org; Sat, 06 Apr 2013 14:22:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UOU0y-0000Z2-T0 for pgsql-performance@postgresql.org; Sat, 06 Apr 2013 14:22:45 +0000 Received: from nm3.bullet.mail.bf1.yahoo.com ([98.139.212.162]) by magus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UOU0l-0000UM-17 for pgsql-performance@postgresql.org; Sat, 06 Apr 2013 14:22:44 +0000 Received: from [98.139.214.32] by nm3.bullet.mail.bf1.yahoo.com with NNFMP; 06 Apr 2013 14:22:29 -0000 Received: from [98.139.215.249] by tm15.bullet.mail.bf1.yahoo.com with NNFMP; 06 Apr 2013 14:22:29 -0000 Received: from [127.0.0.1] by omp1062.mail.bf1.yahoo.com with NNFMP; 06 Apr 2013 14:22:29 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 147420.21058.bm@omp1062.mail.bf1.yahoo.com Received: (qmail 19788 invoked by uid 60001); 6 Apr 2013 14:22:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s1024; t=1365258149; bh=Am7zsnlpcG8aOu4pJL6SRc58zuok0OD93w14RqrOm0k=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=WMGrRSnxD126uTmbobaL6Q1ims2Ex/lIyvGNkKlOeM/NSVEDEd6Z6USwSKFEBQIe8RiR2WPoQulx6meuozNpb5k/BmwUtNGjTzie4cteG5pNpZIH78AxNIqCzUe+omqz2/+AErfdTD5ZIr+4m/rEvwgCp2r2nm03O4uQE5jqjJE= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=ymail.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=dD4bt6bRAMrjb4A7BFAcBz4aT2e4RZS1lDd7ixHSqLHtsLOw1V5aYljKVX7U6f3B3tP9onHhksQih8Bt2J1WWU0M0v30r9mIF6O/aQe/JRCo2rHB9TM8eNJqlWBdBVaKJVvCV6fojU7dBC03aiuhcJ2+E6tFz1Przs+TvLibP8o=; X-YMail-OSG: ZNU9NZgVM1kL.ET._BpySLukt9NS0Eg94TQ5kiy5zmqW001 8e99.WTovvj1s28K3L3BaJ_RNeBSncTnDEaPpaNds6EIFPdr6.UmZrL0aL2X orVQTsLi0kYlvm6w8yKKkXk3JQHdlJQUQHuPBYmLzhgDj4bzogXxqAjrat8N C9uis3N9shGnGUSz3ra4UjN1HoY3VnIoov418vUSLzW1_By49888VPNWraYc A7MrQ_Emw.vLtL4l0XaNLkFRY945TCKVqh1W9vB.Za3AEzE6QBAza3ccL41t dWfej81SIkvtdzNfiSsHNlD71..FjOuRNiPVcZeeDIEPn_iCqc7rIEBn3cdn 1uHetutF17y7bl2yM_0TbjKkzhwxKpitE821cmMGeG.i135mCKxmvjkq._aw BvyslhTs4XjnPiyCennZ7L3v5D4DxIf5lzbw6kPPFPxEfgjHoUJC3crG7BFs bZ4nRLEmMKlu3LbI02tedxZba5zfV0xswIErMLhptpuVFotWmK1Z3rM77xBO hmB9Z4.JW9PiCkdoE6teM4SAzM6TRfv1F2AdLg.w_ Received: from [76.255.18.237] by web162906.mail.bf1.yahoo.com via HTTP; Sat, 06 Apr 2013 07:22:29 PDT X-Rocket-MIMEInfo: 002.001, SnVsaWVuIENpZ2FyIDxqY2lnYXJAdWxiLmFjLmJlPiB3cm90ZToKCj4gdHJ5IHRvIGluY3JlYXNlIGNwdV90dXBsZV9jb3N0IHRvIDAuMQoKSSBhZ3JlZSB0aGF0J3Mgb24gdGhlIHJpZ2h0IHRyYWNrLCBidXQgcG9zc2libHkgYW4gb3Zlcmx5IGJsdW50CnRvb2wgZm9yIHRoZSBqb2IuwqAgVGhlIGZvbGxvd2luZyBzZXR0aW5ncyBhcmUgbGlrZWx5IHRvIG5lZWQKYWRqdXN0bWVudCwgSU1POgoKZWZmZWN0aXZlX2NhY2hlX3NpemU6IFBlb3BsZSBvZnRlbiBzZXQgdGhpcyB0byBzb21ld2hlcmUgaW4gdGhlCnIBMAEBAQE- X-Mailer: YahooMailWebService/0.8.140.532 References: <515FFEB1.4040606@ulb.ac.be> Message-ID: <1365258149.7784.YahooMailNeo@web162906.mail.bf1.yahoo.com> Date: Sat, 6 Apr 2013 07:22:29 -0700 (PDT) From: Kevin Grittner Reply-To: Kevin Grittner Subject: Re: slow joins? To: Julien Cigar , "pgsql-performance@postgresql.org" In-Reply-To: <515FFEB1.4040606@ulb.ac.be> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Julien Cigar wrote: > try to increase cpu_tuple_cost to 0.1 I agree that's on the right track, but possibly an overly blunt tool for the job.=A0 The following settings are likely to need adjustment, IMO: effective_cache_size: People often set this to somewhere in the range of 50% to 75% of the RAM on the machine.=A0 This setting does not allocate RAM, but tells the planner how likely it is to find things in cache for, say, repeated index access.=A0 A higher setting makes the random access involved in index scans seem like less of a problem. random_page_cost: You seem to have a very high cache hit ratio, between shared_buffers and the OS cache.=A0 To model this you should decrease random_page_cost to something just above seq_page_cost or equal to it.=A0 To reflect the relatively low cost of reading a page from the OS cache (compared to actually reading from disk) you might want to reduce both of these below 1.=A0 0.1 is a not-uncommon setting for instances with the active portion of the database well-cached. cpu_tuple_cost: I always raise this; I think our default is just too low to accurately model the cost of reading a row, compared to the cost factors used for other things.=A0 In combination with the above changes I've never had to go beyond 0.03 to get a good plan.=20 I've pushed it to 0.05 to see if that put me near a tipping point for a bad plan, and saw no ill effects.=A0 I've never tried higher than 0.05, so I can't speak to that. In any event, your current cost settings aren't accurately modeling actual costs in your environment for your workload.=A0 You need to adjust them. One of the estimates was off, so increasing the statistics sample size might help, but I suspect that you need to make adjustments like the above in any event. --=20 Kevin Grittner EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance