Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 6CB2265038F for ; Fri, 12 Dec 2008 13:06:07 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 10298-04 for ; Fri, 12 Dec 2008 13:06:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.30]) by mail.postgresql.org (Postfix) with ESMTP id 7EFB365039E for ; Fri, 12 Dec 2008 13:06:04 -0400 (AST) Received: by yw-out-2324.google.com with SMTP id 3so690422ywj.73 for ; Fri, 12 Dec 2008 09:06:03 -0800 (PST) Received: by 10.65.240.16 with SMTP id s16mr3195224qbr.59.1229101563053; Fri, 12 Dec 2008 09:06:03 -0800 (PST) Received: from oxford.xeocode.com.enterprisedb.com (69-196-191-94.dsl.teksavvy.com [69.196.191.94]) by mx.google.com with ESMTPS id k30sm6668615qba.28.2008.12.12.09.06.00 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 12 Dec 2008 09:06:01 -0800 (PST) To: Simon Riggs Cc: Robert Haas , Tom Lane , Kevin Grittner , "jd\@commandprompt.com" , Josh Berkus , Greg Smith , pgsql-hackers@postgresql.org Subject: Re: benchmarking the query planner In-Reply-To: <1229100057.8673.29.camel@ebony.2ndQuadrant> (Simon Riggs's message of "Fri\, 12 Dec 2008 16\:40\:57 +0000") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-Draft-From: ("nnimap+imap.gmail.com:HACKERS" 51040) References: <603c8f070812061019r5aca3aajeaa5493b11c5feff@mail.gmail.com> <603c8f070812092025k6325e0fcud001b205a507a634@mail.gmail.com> <4313.1228931932@sss.pgh.pa.us> <603c8f070812101828p1bd7df49yb8c916adedb49fe1@mail.gmail.com> <9565.1229018968@sss.pgh.pa.us> <1229033073.13078.179.camel@hp_dx2400_1> <87ej0etkfh.fsf@oxford.xeocode.com> <1229039044.13078.193.camel@hp_dx2400_1> <4136ffa0812111823u645b6ec9wdca60b3da4b00499@mail.gmail.com> <1229072675.13078.196.camel@hp_dx2400_1> <603c8f070812120344m67ef2c1fs41806cfb4ff9e396@mail.gmail.com> <1229093975.13078.275.camel@ebony.2ndQuadrant> <87tz99s7bu.fsf@oxford.xeocode.com> <1229100057.8673.29.camel@ebony.2ndQuadrant> From: Gregory Stark Organization: EnterpriseDB Date: Fri, 12 Dec 2008 17:05:58 +0000 Message-ID: <87hc59s4qx.fsf@oxford.xeocode.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200812/959 X-Sequence-Number: 129588 Simon Riggs writes: > The amount of I/O could stay the same, just sample all rows on block. > Lifting the sample size will help large tables. Will it be perfect? No. > But I'll take "better" over "not working at all". That will just raise the table size at which the problems start. It'll still be a constant-sized sample. It will also introduce strange biases. For instance in a clustered table it'll think there are a lot more duplicates than there really are because it'll see lots of similar values. Incidentally we *do* do block sampling. We pick random blocks and then pick random records within those blocks. This was new in, uh, 7.4? 8.0? Sometime around then. It dramatically reduced the i/o requirements but there were long discussions of how to do it without introducing biases. > If we are going to quote literature we should believe all the > literature. We can't just listen to some people that did a few tests > with sample size, but then ignore the guy that designed the MS optimizer > and many others. I'm not sure what you're talking about regarding "some people that did a few tests". I looked around for the paper I keep referencing and can't find it on my laptop. I'll look for it online. But it included a section which was a survey of past results from other papers and the best results required stupidly large sample sizes to get anything worthwhile. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com Ask me about EnterpriseDB's On-Demand Production Tuning