Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TNQqp-0004mZ-Kc for pgsql-performance@postgresql.org; Sun, 14 Oct 2012 16:15:39 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TNQql-0007PC-3X for pgsql-performance@postgresql.org; Sun, 14 Oct 2012 16:15:39 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q9EGFW1b026281; Sun, 14 Oct 2012 12:15:33 -0400 (EDT) From: Tom Lane To: henk de wit cc: "pgsql-performance@postgresql.org" Subject: Re: Query with limit goes from few ms to hours In-reply-to: References: Comments: In-reply-to henk de wit message dated "Sun, 14 Oct 2012 09:04:35 +0200" Date: Sun, 14 Oct 2012 12:15:32 -0400 Message-ID: <26280.1350231332@sss.pgh.pa.us> X-Pg-Spam-Score: -2.3 (--) X-Archive-Number: 201210/178 X-Sequence-Number: 48137 henk de wit writes: > For some reason the mailinglist software seems to block the email as soon as the planner details are in it, so I pasted those on pastebin.com: http://pastebin.com/T5JTwh5T You need a less horrid estimate for the join size. Possibly an ANALYZE on the parent table (stream_store) would help. regards, tom lane