Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 18DF3B5DBE4 for ; Thu, 9 Jun 2011 02:57:49 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 40228-05 for ; Thu, 9 Jun 2011 05:57:41 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.9]) by mail.postgresql.org (Postfix) with ESMTP id 70B35B5D801 for ; Thu, 9 Jun 2011 02:57:41 -0300 (ADT) Received: from [192.168.1.3] (mail.highperformancepostgresql.com [71.179.240.8]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0LqpOw-1Prezd1MkU-00eMiN; Thu, 09 Jun 2011 07:57:27 +0200 Message-ID: <4DF060C5.8000702@2ndquadrant.com> Date: Thu, 09 Jun 2011 01:57:25 -0400 From: Greg Smith User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: Samuel Gendler CC: Kevin Grittner , pgsql-performance@postgresql.org Subject: Re: poor performance when recreating constraints on large tables References: <12692.1307392671@sss.pgh.pa.us> <4DEF8CEC020000250003E38D@gw.wicourts.gov> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:SWbQeVVfGZw4IS3Rx+f1/JhCIr296kG4Suf3p21HDyi uFLGjklPl1kUt+hlKL3fjitZjX4kGiOgkvHsKdgv1arJrAOOgg ylMJyUYhC21XeIzW9w9PTz/GWHQW7ZLEaGB1E8duhiXe+1C9EJ Cqkh2g6Ds5Wlhfuy37f1eubs5Cf+aZz/HVgA70DKmSKmUtL6e2 e2AxtKXQHXS6hlPMJKpBpOEpy/fdUKabGvMNfOciak= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201106/89 X-Sequence-Number: 44022 Samuel Gendler wrote: > Sure, but if it is a query that is slow enough for a time estimate to > be useful, odds are good that stats that are that far out of whack > would actually be interesting to whoever is looking at the time > estimate, so showing some kind of 'N/A' response once things have > gotten out of whack wouldn't be unwarranted. The next question is what are you then going to do with that information? The ability to track some measure of "progress" relative to expectations is mainly proposed as something helpful when a query has gone out of control. When that's happened, the progress meter normally turns out to be fundamentally broken; the plan isn't happening at all as expected. So, as you say, you will get an "N/A" response that says the query is out of control, when in the cases where this sort of thing is expected to be the most useful. At that point, you have two choices. You can let the query keep running and see how long it really takes. You have no idea how long that will be, all you can do is wait and see because the estimation is trashed. Or you can decide to kill it. And the broken progress meter won't help with that decision. So why put it there at all? What I try to do as a force of habit is run just about everything that might take a while with "\timing" on, and try to keep statement_timeout to a reasonable value at all times. Do that enough, and you get a feel for what reasonable and unreasonable time scales look like better than the query executor can be expected to figure them out for you. It would be nice to provide a better UI here for tracking progress, but it would really work only in the simplest of cases--which are of course the ones you need it the least for. -- Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us "PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books