Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Us3CA-0005eR-SQ for pgsql-performance@arkaria.postgresql.org; Thu, 27 Jun 2013 03:48:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Us3CA-0007Tn-8t for pgsql-performance@arkaria.postgresql.org; Thu, 27 Jun 2013 03:48:30 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Us3C8-0007Te-0J for pgsql-performance@postgresql.org; Thu, 27 Jun 2013 03:48:28 +0000 Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Us3C0-0005XI-To for pgsql-performance@postgresql.org; Thu, 27 Jun 2013 03:48:27 +0000 Received: by mail-pa0-f49.google.com with SMTP id ld11so455866pab.22 for ; Wed, 26 Jun 2013 20:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=BAEMmvqQ1Xr1EP/8FcoBATJG+nmEagzzbNtgsmEkCqU=; b=wBCVqKzPjY71jqhkLlXUZLog0g4DOgRfe3sUFvt/0L4yjqEWJXx6QqSdHGAPa5orSC oSt78DcCeoW+15GbErrBi9rjeg9Uik4+ECBrH4WPYt/VmOg5WiFCVgq+TGnX8htHCBu2 WfZnEI8e9NlfUUkiyBBd1cHX8Senmt4du1k8rpXmA+UtNaa7hhKvoUWc6+6wy6BuZwg/ 5SC3WHgW+uo4DSnacj1dj774/gYz25pgj2pqR3Edl4GP8sDDaGWLCU/BbbpYvGuUKb4A o/aZ6PfoL8LgHQbTZEb4f1vbgezUMQCTkH90wL1HsSJzgEzokS4+q5aVp9RDT/fN8Ae+ 0dtw== X-Received: by 10.66.49.104 with SMTP id t8mr3811657pan.65.1372304899907; Wed, 26 Jun 2013 20:48:19 -0700 (PDT) Received: from [192.168.1.107] (50-0-92-83.dsl.dynamic.sonic.net. [50.0.92.83]) by mx.google.com with ESMTPSA id ai6sm1595897pad.15.2013.06.26.20.48.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Jun 2013 20:48:18 -0700 (PDT) Subject: Re: incorrect row estimates for primary key join Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=utf-8 From: Ben In-Reply-To: Date: Wed, 26 Jun 2013 20:48:16 -0700 Cc: Tom Lane , Kevin Grittner , bricklen , "pgsql-performance@postgresql.org list" Content-Transfer-Encoding: quoted-printable Message-Id: <81857BFB-509B-45F5-A7CD-2716A3FFD46A@gmail.com> References: <7D0DD8B1-D23C-4BBC-9AB2-20D81F0B4BB8@gmail.com> <9A75BF4B-0458-43E3-803B-E25BB1984A39@gmail.com> <1372166429.65996.YahooMailNeo@web162901.mail.bf1.yahoo.com> <1372198395.32951.YahooMailNeo@web162904.mail.bf1.yahoo.com> <19479.1372203377@sss.pgh.pa.us> To: =?utf-8?Q?Marcin_Ma=C5=84k?= X-Mailer: Apple Mail (2.1283) X-Pg-Spam-Score: 0.7 (/) 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 On Jun 26, 2013, at 5:22 PM, Marcin Ma=C5=84k wrote: > On Wed, Jun 26, 2013 at 2:29 AM, Ben wrote: >=20 >> shouldn't an index scan definitely be fastest here? you don't need to t= ouch the whole table or index. maybe there something i have misconfigured = here? >>=20 >=20 > How about you try increasing work_mem ? I think a hash join may be the > best plan here, and it won't get chosen with low work_mem . i will increase work_mem and experiment for the other queries, but the quer= y which i was asking about in this particular question was looking up the s= ingle smallest key in the primary key index, which seems like it shouldn't = need to touch more than one key, since it can just get the first one from a= n in-order index traversal. of course with my earlier bigtable/jointable j= oin question increasing work_mem makes a lot of sense. best regards, ben --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance