Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1akSl1-0003cb-Dk for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Mar 2016 08:42:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1akSl0-00039h-T2 for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Mar 2016 08:42:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1akSl0-00039b-40 for pgsql-hackers@postgresql.org; Mon, 28 Mar 2016 08:42:42 +0000 Received: from mail-pa0-x230.google.com ([2607:f8b0:400e:c03::230]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1akSku-0000eg-Tx for pgsql-hackers@postgresql.org; Mon, 28 Mar 2016 08:42:41 +0000 Received: by mail-pa0-x230.google.com with SMTP id fe3so93287763pab.1 for ; Mon, 28 Mar 2016 01:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=ZlCvV4p4n15AynU7ceTdCMJIJPHDOpQKCZki2tyTeKo=; b=brXe+JOfpWShwJqgauaBU5ZFPP+j5n8151wSlc6DSDI6fGhK29IoPfYN0ZfgfQoV/q YxXlvR6NpBAk1qHP0RzHukomK86KDAzMYazor7rH4PhNHiYnGlJOYF21pC5WhsBcjg7w G2RjvQ27OBwe4p8CE11MVrHKMp6CBSU0pchUhKQZG20MYE/woQ1wTXyGOyOlYY94j+Qu /pPyojudaZAEGO6jgl+pXtFXhK9PxWHUL5fEAgC4GSyFLdRz/TEyEOmw9cMTLgG2Z21t o6LwUxL50ub++ypGQQBYZcHvuKXOtf681jlUZgsm/bJ3MsA29Cd5MrOJ+jyp0OF59Q3R bsyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=ZlCvV4p4n15AynU7ceTdCMJIJPHDOpQKCZki2tyTeKo=; b=bZICp89sQ8yfECHv/is8YYj4VksJqgVLgw0qvAAQmLIIur/j+I4X2dfuGxgl+PuSjw 9jF3CzU4Ko7QvnM9Ns/p4QV36GZ7xMog+vdnYfDJxWoe6u2IhkJ4a8kgLdk2GUi2wFMZ Voc1O8meihKBUm/9p7Fq1awM05zy+T1MSSbrAic5Njf10XBuJqDjQ/DyDHHjivfCr4MO pe5xaavG3r2meDEMDGImLDjP7puHlxQ63YM6RMUYCFNzWdOMH4OQdgRVIizmsiPhX89d uAsPUKPVpec6l9uwJ0VZ5jrPRhZlKEihVmtxBM5akvu5PFC8rXnm+KbdUmjb18uE0j9a PT3g== X-Gm-Message-State: AD7BkJLxqba9zzrm0uZc616Gq2kFLMKCc4VmjyvSWugXol6yvPVzWDdwG/kT+11dA1epDTpH4GvNPwJ36sodiauujDneGsIqGyzUA6+HdV5gL6zE4xnVhpVNPNqPuSTxjaDdkOsrdxt73gRGFPH5ZNgfMcZmsse0PYoesB6qFpJomnk5qwQrc59eDioJVUEiQRGDqax1I+Vu X-Received: by 10.66.150.170 with SMTP id uj10mr40386105pab.91.1459154554412; Mon, 28 Mar 2016 01:42:34 -0700 (PDT) Received: from [10.137.2.14] ([61.8.221.8]) by smtp.gmail.com with ESMTPSA id ch2sm17429643pad.28.2016.03.28.01.42.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Mar 2016 01:42:33 -0700 (PDT) Subject: Re: multivariate statistics v14 To: Tatsuo Ishii References: <060fe904-7210-cc5a-65d7-02f6e8f0cb1e@2ndquadrant.com> <26597.1458941172@sss.pgh.pa.us> <20160326.181833.1902389187691662331.t-ishii@sraoss.co.jp> Cc: tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, petr@2ndquadrant.com, jeff.janes@gmail.com, pgsql-hackers@postgresql.org From: Tomas Vondra Message-ID: <95089064-e388-2cd1-ab62-7c88890eaf67@2ndquadrant.com> Date: Mon, 28 Mar 2016 10:42:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Thunderbird/46.0a2 MIME-Version: 1.0 In-Reply-To: <20160326.181833.1902389187691662331.t-ishii@sraoss.co.jp> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Hi, On 03/26/2016 10:18 AM, Tatsuo Ishii wrote: >> Fair point. Attached is v18 of the patch, after pgindent cleanup. > > Here are some feedbacks to v18 patch. > > 1) regarding examples in create_statistics manual > > Here are numbers I got. "with statistics" referrers to the case where > multivariate statistics are used. "without statistics" referrers to the > case where multivariate statistics are not used. The numbers denote > estimated_rows/actual_rows. Thus closer to 1.0 is better. Some numbers > are shown as a fraction to avoid 0 division. In my understanding case > 1, 3, 4 showed that multivariate statistics superior. > > with statistics without statistics > case1 0.98 0.01 > case2 98/0 1/0 The case2 shows that functional dependencies assume that the conditions used in queries won't be incompatible - that's something this type of statistics can't fix. > case3 1.05 0.01 > case4 1/0 103/0 > case5 18.50 18.33 > case6 111123/0 1111123/0 The last two lines (case5 + case6) seem a bit suspicious. I believe those are for the histogram data, and I do get these numbers: case5 0.93 (5517 / 5949) 42.0 (249943 / 5949) case6 100/0 100/0 Perhaps you've been using the version before the bugfix, with ANALYZE on the wrong table? > > 2) following comments by me are not addressed in the v18 patch. > >> - There's no docs for pg_mv_statistic (should be added to "49. System >> Catalogs") >> >> - The word "multivariate statistics" or something like that should >> appear in the index. >> >> - There are some explanation how to deal with multivariate statistics >> in "14.1 Using Explain" and "14.2 Statistics used by the Planner" >> section. Yes, those are valid omissions. I plan to address them, and I'd also considering adding a section to 65.1 (How the Planner Uses Statistics), explaining more thoroughly how the planner uses multivariate stats. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers