Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TjCL9-0000mN-KF for pgsql-performance@arkaria.postgresql.org; Thu, 13 Dec 2012 17:12:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TjCL8-0004Ms-NA for pgsql-performance@arkaria.postgresql.org; Thu, 13 Dec 2012 17:12:54 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TjCL7-0004Mn-UD for pgsql-performance@postgresql.org; Thu, 13 Dec 2012 17:12:54 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TjCL6-0003U9-RW for pgsql-performance@postgresql.org; Thu, 13 Dec 2012 17:12:53 +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 qBDHCokm007064; Thu, 13 Dec 2012 12:12:50 -0500 (EST) From: Tom Lane To: "Kevin Grittner" cc: "Pavan Deolasee" , "Amitabh Kant" , "pgsql-performance" Subject: Re: Limit & offset effect on query plans In-reply-to: <20121213170700.80080@gmx.com> References: <20121213170700.80080@gmx.com> Comments: In-reply-to "Kevin Grittner" message dated "Thu, 13 Dec 2012 12:07:00 -0500" Date: Thu, 13 Dec 2012 12:12:50 -0500 Message-ID: <7063.1355418770@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) 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 "Kevin Grittner" writes: > Tom Lane wrote: >> 1.35ms out of what? > Without the limit node the runtimes (after "priming" the cache) > were: > 1.805, 2.533 > 1.805, 2.495 > 1.800, 2.446 > 1.818, 2.470 > 1.804, 2.502 > The first time for each run is "Total runtime" reported by EXPLAIN, > the second is what psql reported from having \timing on. > With the limit node: > 3.237, 3.914 > 3.243, 3.918 > 3.263, 4.010 > 3.265, 3.943 > 3.272, 3.953 > I eyeballed that in the console window and said 1.35 based on rough > in-my-head calculations, although with it laid out in a nicer > format, I think I was a little low. Huh, so on a percentage basis the Limit-node overhead is actually pretty significant, at least for a trivial seqscan plan like this case. (This is probably about the worst-case scenario, really, since it's tough to beat a simple seqscan for cost-per-emitted-row. Also I gather you're not actually transmitting any data to the client ...) regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance