X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2BBD49DCA06 for ; Fri, 16 Dec 2005 09:17:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16922-04 for ; Fri, 16 Dec 2005 09:17:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by postgresql.org (Postfix) with ESMTP id 225D39DC807 for ; Fri, 16 Dec 2005 09:17:25 -0400 (AST) Received: from [192.168.0.2] (unknown [84.12.183.55]) by smtp.nildram.co.uk (Postfix) with ESMTP id D109B269EC8; Fri, 16 Dec 2005 13:17:23 +0000 (GMT) Subject: Re: How much expensive are row level statistics? From: Simon Riggs To: Tom Lane Cc: Michael Fuhr , Merlin Moncure , pgsql-performance@postgresql.org, Carlos Benkendorf In-Reply-To: <18416.1134691599@sss.pgh.pa.us> References: <6EE64EF3AB31D5448D0007DD34EEB3417DDAC9@Herge.rcsinc.local> <2506.1134428461@sss.pgh.pa.us> <20051213010751.GA63416@winnie.fuhr.org> <1667.1134444045@sss.pgh.pa.us> <20051215234448.GA47382@winnie.fuhr.org> <18416.1134691599@sss.pgh.pa.us> Content-Type: text/plain Date: Fri, 16 Dec 2005 13:17:25 +0000 Message-Id: <1134739045.2964.15.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/391 X-Sequence-Number: 16212 On Thu, 2005-12-15 at 19:06 -0500, Tom Lane wrote: > Michael Fuhr writes: > > Does the backend support, or could it be easily modified to support, > > a mechanism that would post the command string after a configurable > > amount of time had expired, and then continue processing the query? > > Not really, unless you want to add the overhead of setting a timer > interrupt for every query. Which is sort of counterproductive when > the motivation is to reduce overhead ... > > (It might be more or less free if you have statement_timeout set, since > there would be a setitimer call anyway. But I don't think that's the > norm.) We could do the deferred send fairly easily. You need only set a timer when stats_command_string = on, so we'd only do that when requested by the admin. Overall, that would be a cheaper way of doing it than now. However, I'm more inclined to the idea of a set of functions that allow an administrator to retrieve the full SQL text executing in a backend, with an option to return an EXPLAIN of the currently executing plan. Right now, stats only gives you the first 1000 chars, so you're always stuck if its a big query. Plus we don't yet have a way of getting the exact EXPLAIN of a running query (you can get close, but it could differ). Pull is better than push. Asking specific backends what they're doing when you need to know will be efficient; asking them to send their command strings, all of the time, deferred or not will always be more wasteful. Plus if you forgot to turn on stats_command_string before execution, then you've no way of knowing anyhow. Best Regards, Simon Riggs