Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gi4DM-0004jr-Dg for pgsql-hackers@arkaria.postgresql.org; Fri, 11 Jan 2019 21:19:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gi4CN-0007B2-2E for pgsql-hackers@arkaria.postgresql.org; Fri, 11 Jan 2019 21:18:39 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1gi4CM-0007Av-R8 for pgsql-hackers@lists.postgresql.org; Fri, 11 Jan 2019 21:18:38 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gi4CK-0001FE-3L for pgsql-hackers@postgresql.org; Fri, 11 Jan 2019 21:18:38 +0000 Received: by mail-wr1-x42f.google.com with SMTP id j2so16722167wrw.1 for ; Fri, 11 Jan 2019 13:18:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=qxXvtoaEBe+wgMA31pc9xQL4c6KFPT3Ez3APh+L1cCM=; b=BXecTqkQHaeyJe2kbZ+KgqqDeJCnDSAZN157J6sDngk+LCFGQwS+ktpMCpnAce5RPq MYPLnjAL2kumhTRNcPEz94XUyrnnVWHWDyQO0RZnmC/qhEGUIGHRrFPw6lPIgUWbreCM ANlbUhJ/mBaOhtwAA8phTHXZY5jWkp8eeEgKdy/twbHOm6L60WGjKnE6xU48v4LTCoPH NqQBTHhf2aIgxP9yrdZ9/Am4P1fUkO86i/Y9sPLF+oTbNTub9AlAbi/rFsyb4ePsnGOd FFEvsWeo2b5aBF9q8Lc6xNcbo5McdSEWc8jHJWm9hFjvMm0zm9NMJ8EmjoHGA4p4S4WL jxJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qxXvtoaEBe+wgMA31pc9xQL4c6KFPT3Ez3APh+L1cCM=; b=sfEy4/VB3tP3UOjKhLeCM2Jo6QYfI8yG5YOGD57x3rUG61YKvyf8mXyJFSopgfDJ2k MVQ+qmw4ajoNKlDcB3OGFTgvODvKaG9KqBPz1Qoa1kBrYpQlFFIJDj8WBusBCWRQhZHy etEmfO48irgO3Zx+Z2yf2UDsqA9zYkY0a5HyDbbStGTwTFLBHKmO45Xg9WZfjgkw8iTW CVxHH6FhpU099knzMlRcuDh8R10ZUC+wC2c4SmbYIqr1FQhz/jAHned0xXzflcG5PxhM jwhZupcc9GZji9TpbBelQdPFVNZHVDUwFkQPrwR3RzbKlrvaOcJDXZlJIWmeCQtvNxn7 7ZzQ== X-Gm-Message-State: AJcUuke+Wj1NKWWdVIX0lFQJ7FO3/BKHCXWA+CrCBqwYCe42cbXrqbnR WZJuleVwgllr9WbASjYJ3RnRWU3oHwYPnSHKuBVqfyIaegORJKZrVP3v2qVJfYRopdW8yE9zSZq 7ovHCkKyswa7kmByTbOM27/03hTSozwM1ii9CImNHQDM8d4qeLgs7EfN0zl8OieZFJJKJe8TYcW 4cW7Nf6niFtak= X-Google-Smtp-Source: ALg8bN7r8W8bA1AzixsDQL7/zjLZ0Owcqs+E697MabaFIw9P/wKEy3lIRnavLz1jVLmIiVfKfBBQwA== X-Received: by 2002:adf:e7d0:: with SMTP id e16mr15772949wrn.142.1547241514852; Fri, 11 Jan 2019 13:18:34 -0800 (PST) Received: from [10.137.2.21] (ip-86-49-251-50.net.upcbroadband.cz. [86.49.251.50]) by smtp.gmail.com with ESMTPSA id j8sm49946617wrt.40.2019.01.11.13.18.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Jan 2019 13:18:33 -0800 (PST) Subject: Re: [HACKERS] PATCH: multivariate histograms and MCV lists To: Dean Rasheed Cc: Thomas Munro , Bruce Momjian , Alvaro Herrera , Andres Freund , Mark Dilger , Adrien Nayrat , Pg Hackers References: <49348328-1a02-7e45-e50f-e1d4d0243c5c@2ndquadrant.com> <80bc98b2-1c43-1fe8-b316-d447bb68cff2@2ndquadrant.com> <341ca23f-144d-130d-1b45-ddddf581797e@2ndquadrant.com> <8ac8bd94-478d-215d-e6bd-339f1f20a74c@2ndquadrant.com> <11b0d685-152d-8320-5f49-a7c6ac3ee90a@2ndquadrant.com> <3b8577ba-6a29-d1f0-b155-d3a50c1a8399@2ndquadrant.com> <11223173-bd90-4fa8-8cf1-49928b615405@2ndquadrant.com> From: Tomas Vondra Message-ID: Date: Fri, 11 Jan 2019 22:18:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/10/19 4:20 PM, Dean Rasheed wrote: > ... > > So perhaps what we should do for multivariate stats is simply use the > relative standard error approach (i.e., reuse the patch in [2] with a > 20% RSE cutoff). That had a lot of testing at the time, against a wide > range of data distributions, and proved to be very good, not to > mention being very simple. > > That approach would encompass both groups more and less common than > the base frequency, because it relies entirely on the group appearing > enough times in the sample to infer that any errors on the resulting > estimates will be reasonably well controlled. It wouldn't actually > look at the base frequency at all in deciding which items to keep. > I've been looking at this approach today, and I'm a bit puzzled. That patch essentially uses SRE to compute mincount like this: mincount = n*(N-n) / (N-n+0.04*n*(N-1)) and then includes all items more common than this threshold. How could that handle items significantly less common than the base frequency? Or did you mean to use the SRE, but in some different way? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services