Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 2B85A632712 for ; Sun, 22 Mar 2009 21:57:12 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 14750-05 for ; Sun, 22 Mar 2009 21:57:03 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ew0-f167.google.com (mail-ew0-f167.google.com [209.85.219.167]) by mail.postgresql.org (Postfix) with ESMTP id AFCC36322F0 for ; Sun, 22 Mar 2009 21:57:07 -0300 (ADT) Received: by ewy11 with SMTP id 11so2774133ewy.19 for ; Sun, 22 Mar 2009 17:57:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :received:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=AmYiKf7eMoWmhA2zw2Sw2zkAcsKgouMl/fGp6Zfg57I=; b=BhVQIM6BJokqkBIGFBkvzUrcSVOUhu5yzWl5GC/LR7xOGQ+cjxsK5X0HqP67sYTmyK XBuBwXtmmizsEFiG4poOsgMVhVM2x4eDDlDP8yI8i4+qdenkZNFsJozdNcmlmEUPLyps MHgL8MXB1p8lr8CLsSvPT/q5tkKKOkxrNbmZ0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=TcUd6mGo7IwuzIWHnTGVYP36w/x4U467SsS0JTO0v0XTFUhg8dRXaOPExug83UoZmY J7UxBAMkwL381+R9/CVhLLGsaeGt3Ygd4O1VW5+0pMueHuvrmQMhYfKrApc2iyl2gpSc jtrtSaENBWNBZlFHU1KLZXa0xWtSX673b1zmw= MIME-Version: 1.0 In-Reply-To: References: <49A295F0.5010405@saparev.com> <49A2A450.20002@archonet.com> <49A2DFFA.8000001@saparev.com> <18725.1235412110@sss.pgh.pa.us> <49A429A3.9010803@saparev.com> <17814.1237757356@sss.pgh.pa.us> Date: Mon, 23 Mar 2009 01:56:50 +0100 Received: by 10.210.59.14 with SMTP id h14mr4969741eba.68.1237769825364; Sun, 22 Mar 2009 17:57:05 -0700 (PDT) Message-ID: Subject: Re: LIMIT confuses the planner From: marcin mank To: Tom Lane Cc: kouber@saparev.com, pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 200903/323 X-Sequence-Number: 33245 > I hit an interestinhg paper on n_distinct calculation: > > http://www.pittsburgh.intel-research.net/people/gibbons/papers/distinct-values-chapter.pdf > > the PCSA algorithm described there requires O(1) calculation per > value. Page 22 describes what to do with updates streams. > > This I think (disclaimer: I know little about PG internals) means that > the n_distinct estimation can be done during vacuum time (it would > play well with the visibility map addon). > > What do You think? ok, if You think that calculating a has function of every data field for each insert or delete is prohibitive, just say so and don`t bother reading the paper :] Greetings Marcin