Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 9D0B42E2FE6 for ; Wed, 5 Dec 2007 16:07:42 -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 21478-02 for ; Wed, 5 Dec 2007 16:07:31 -0400 (AST) Received: from mail.omniti.com (mail.omniti.com [66.225.209.50]) by postgresql.org (Postfix) with ESMTP id EF5CA2E0057 for ; Wed, 5 Dec 2007 16:07:38 -0400 (AST) Authentication-Results: mail.omniti.com smtp.user=robert; auth=pass (LOGIN) Received: from [10.80.116.156] ([10.80.116.156:48158] helo=dhcp-0-28.office.omniti.com) by mail.omniti.com (ecelerity 2.1.1.12 r(14453)) with ESMTPSA (cipher=EXP1024-RC4-SHA) id 71/43-30988-DF407574 for ; Wed, 05 Dec 2007 15:07:32 -0500 From: Robert Treat To: pgsql-performance@postgresql.org Subject: Re: TB-sized databases Date: Wed, 5 Dec 2007 15:07:21 -0500 User-Agent: KMail/1.9.1 Cc: Simon Riggs , Tom Lane , Gregory Stark , Csaba Nagy , Bill Moran References: <4544e0330711260904g45d893a8ub1731e245aa8fc84@mail.gmail.com> <13851.1196351131@sss.pgh.pa.us> <1196352866.4246.1304.camel@ebony.site> In-Reply-To: <1196352866.4246.1304.camel@ebony.site> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200712051507.22745.xzilla@users.sourceforge.net> Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/72 X-Sequence-Number: 27888 On Thursday 29 November 2007 11:14, Simon Riggs wrote: > On Thu, 2007-11-29 at 10:45 -0500, Tom Lane wrote: > > Gregory Stark writes: > > > "Simon Riggs" writes: > > >> Tom's previous concerns were along the lines of "How would know what > > >> to set it to?", given that the planner costs are mostly arbitrary > > >> numbers. > > > > > > Hm, that's only kind of true. > > > > The units are not the problem. The problem is that you are staking > > non-failure of your application on the planner's estimates being > > pretty well in line with reality. Not merely in line enough that > > it picks a reasonably cheap plan, but in line enough that if it > > thinks plan A is 10x more expensive than plan B, then the actual > > ratio is indeed somewhere near 10. > > > > Given that this list spends all day every day discussing cases where the > > planner is wrong, I'd have to think that that's a bet I wouldn't take. > > I think you have a point, but the alternative is often much worse. > > If an SQL statement fails because of too high cost, we can investigate > the problem and re-submit. If a website slows down because somebody > allowed a very large query to execute then everybody is affected, not > just the person who ran the bad query. Either way the guy that ran the > query loses, but without constraints in place one guy can kill everybody > else also. > > > You could probably avoid this risk by setting the cutoff at something > > like 100 or 1000 times what you really want to tolerate, but how > > useful is it then? > > Still fairly useful, as long as we understand its a blunt instrument. > > If the whole performance of your system depends upon indexed access then > rogue queries can have disastrous, unpredictable consequences. Many > sites construct their SQL dynamically, so a mistake in a seldom used > code path can allow killer queries through. Even the best DBAs have been > known to make mistakes. > 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? > 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. -- Robert Treat Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL