Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 0B4532E3357 for ; Thu, 6 Dec 2007 05:38:34 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 62743-02-4 for ; Thu, 6 Dec 2007 05:38:23 -0400 (AST) Received: from outmail128072.authsmtp.co.uk (outmail128072.authsmtp.co.uk [62.13.128.72]) by postgresql.org (Postfix) with ESMTP id EE5772E322B for ; Thu, 6 Dec 2007 05:38:25 -0400 (AST) Received: from outmail128177.authsmtp.com (outmail128177.authsmtp.com [62.13.128.177]) by punt4.authsmtp.com (8.14.1/8.14.1/Kp) with ESMTP id lB69btfN048074; Thu, 6 Dec 2007 09:37:55 GMT Received: from [192.168.0.3] (85-211-24-246.dyn.gotadsl.co.uk [85.211.24.246]) (authenticated bits=0) by mail.authsmtp.com (8.13.8/8.13.8/Kp) with ESMTP id lB69bsEa037021; Thu, 6 Dec 2007 09:37:54 GMT Subject: Re: TB-sized databases From: Simon Riggs To: Robert Treat Cc: pgsql-performance@postgresql.org, Tom Lane , Gregory Stark , Csaba Nagy , Bill Moran In-Reply-To: <200712051507.22745.xzilla@users.sourceforge.net> References: <4544e0330711260904g45d893a8ub1731e245aa8fc84@mail.gmail.com> <13851.1196351131@sss.pgh.pa.us> <1196352866.4246.1304.camel@ebony.site> <200712051507.22745.xzilla@users.sourceforge.net> Content-Type: text/plain Date: Thu, 06 Dec 2007 09:38:16 +0000 Message-Id: <1196933896.4255.340.camel@ebony.site> Mime-Version: 1.0 X-Mailer: Evolution 2.8.2 Content-Transfer-Encoding: 7bit X-Server-Quench: ebeb31bd-a3de-11dc-814e-001185d377ca X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksacBtFaANbaVxS HGQLW1NEUFR7WmR/ bg8fZQBDYEtPQQdu TkpNRE1QERpoT0Bz ABdMEWwjdwZBeHxx K0RkXXYVCRYvJ0V8 EBpJRG5SMHphaTRM TUhZc1ZJcANLfxdA PlN4UyBcLwdSbGoL JyIJERcLGAAXFA4Q WQAfIF5aTU8XFzQ1 XB0ZdWxf X-Authentic-SMTP: 61633235383639.squirrel.dmpriest.net.uk:787/Kp X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Status: No virus detected - but ensure you scan with your own anti-virus system! X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/79 X-Sequence-Number: 27895 Robert, On Wed, 2007-12-05 at 15:07 -0500, Robert Treat wrote: > If the whole performance of your system depends upon indexed access, then > maybe you need a database that gives you a way to force index access at the > query level? That sounds like a request for hints, which is OT here, ISTM. The issue is that if somebody issues a "large query" then it will be a problem whichever plan the query takes. Forcing index scans can make a plan more expensive than a seq scan in many cases. > > e.g. An 80GB table has 8 million blocks in it. > > - So putting a statement_cost limit = 1 million would allow some fairly > > large queries but prevent anything that did a SeqScan (or worse). > > - Setting it 10 million is going to prevent things like sorting the > > whole table without a LIMIT > > - Setting it at 100 million is going to prevent unconstrained product > > joins etc.. > > I think you're completly overlooking the effect of disk latency has on query > times. We run queries all the time that can vary from 4 hours to 12 hours in > time based solely on the amount of concurrent load on the system, even though > they always plan with the same cost. Not at all. If we had statement_cost_limit then it would be applied after planning and before execution begins. The limit would be based upon the planner's estimate, not the likely actual execution time. So yes a query may vary in execution time by a large factor as you suggest, and it would be difficult to set the proposed parameter accurately. However, the same is also true of statement_timeout, which we currently support, so I don't see this point as an blocker. Which leaves us at the burning question: Would you use such a facility, or would the difficulty in setting it exactly prevent you from using it for real? -- Simon Riggs 2ndQuadrant http://www.2ndQuadrant.com