Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aDVJG-0006CD-Uo for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Dec 2015 10:45:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aDVJG-0000Bc-CL for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Dec 2015 10:45:50 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aDVHw-00075d-0U for pgsql-hackers@postgresql.org; Mon, 28 Dec 2015 10:44:28 +0000 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aDVHo-0006w4-UU for pgsql-hackers@postgresql.org; Mon, 28 Dec 2015 10:44:26 +0000 Received: by mail-wm0-x22a.google.com with SMTP id f206so3347108wmf.0 for ; Mon, 28 Dec 2015 02:44:20 -0800 (PST) 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-type:content-transfer-encoding; bh=NyEcNxfef7XZLu0q1ZlsSWiCrjPt1bJ8tDDqJVFR9AY=; b=RIlCwnQ7X2/WBPKsHzI+IdC5U899AEGCdUdGhLxejkEZAYD+H+ZK1iBiEs4gkZ3rQy J8qtspApJaDjkVv9yR8gcHhJzewwP00nw5ad7avXCn5QUauvHDTTbZ7HqnFylvNtP9kt M5ePbagmof3XA5qyAhgpUYmyaxVv09FNGhgaG3HuLO2/ciN6zBOsFwVW5L6gx09mtjDs vZaXnH0VE7jt+9Pk3syKlZyVM3lvr+UhVFutrL9cEZi2XocIy11jJp6oZAWGKCbWl6RZ 86EpXUQcbNg7uHc+2mDlaq2YblFYRJEzeYDJoIXsglrm9w9K65uot6ovosqh0W0JtZhS 0khw== 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-type :content-transfer-encoding; bh=NyEcNxfef7XZLu0q1ZlsSWiCrjPt1bJ8tDDqJVFR9AY=; b=Cj/17GJuxERdIcaoKSDpHQUmY/84SRWFZTEtZYKWpHisVpk3qMBZGgh8dVJO13SQot eonEGZXKEDWP6NnIupf8fh1/grHuaeT6pSSLRonYNVeN1KxBY3u5wQk/0oQhnB3TJol2 LN+gtibZwfTgX/UIVXzg75SydH+aG4eEIbE0KZ4DxP5z4YFVjnV9wHUnNaHh7YFrBY9C i1GUCXuMjn28RZwTlSJpm2UzblNKxyJHzN9t97C0VtnIwWcTnRV9RER2jvgCjiu/KOB6 0V2+HssFk3EpoR/O5Gr7jWCFNR9IW6nscFSydDn8cjcCQLH8pYkrqZqH8eC3f409mju1 kP9A== X-Gm-Message-State: ALoCoQk4rR1+oyGD8J0QRCkGDUxbzG6CBy++MDrdHC7qs2+EMISyM0hcOIHgK9LSEd9YF8KGa/caIXHuAZVoT6dJonc4ZGK2gfdHPrh7tTdW352Qr9c9xMI4v4CybYu2wBa9iWSbgsZ+kFv07nlleZfKhG7tQAO3N0r0vDSvtkPfHJ+xGDyxuWtCU9jzUcZLnOUfnpOXnqgANJWL6CdhWPoR33EFSso7tg== X-Received: by 10.194.86.166 with SMTP id q6mr29212138wjz.69.1451299459443; Mon, 28 Dec 2015 02:44:19 -0800 (PST) Received: from [10.137.2.14] ([151.217.228.221]) by smtp.gmail.com with ESMTPSA id q6sm56394967wjx.28.2015.12.28.02.44.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Dec 2015 02:44:18 -0800 (PST) Subject: Re: WIP: bloom filter in Hash Joins with batches To: David Rowley References: <5670946E.8070705@2ndquadrant.com> <5672D617.9060601@2ndquadrant.com> <56810D8C.3020309@2ndquadrant.com> Cc: "Shulgin, Oleksandr" , PostgreSQL Hackers From: Tomas Vondra Message-ID: <5681127F.9080301@2ndquadrant.com> Date: Mon, 28 Dec 2015 11:44:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; 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 On 12/28/2015 11:38 AM, David Rowley wrote: > On 28 December 2015 at 23:23, Tomas Vondra > wrote: > > On 12/28/2015 03:15 AM, David Rowley wrote: > > Maybe it would be better to, once the filter is built, simply > count the > > number of 1 bits and only use the filter if there's less than > 1 bits compared to the size of the filter in bits. > There's > functionality in bms_num_members() to do this, and there's > also __builtin_popcount() in newer version of GCC, which we > could have > some wrapper around, perhaps. > > > I don't really see how this is relevant with the previous point. The > number of 1s in the bitmap can tell you the false positive rate for > the bloom filter, not what fraction of lookups will be answered with > "true". > > So while this needs to be watched, so that we stop using the bloom > filter when it gets too full (e.g. due to under-estimate), it's > completely unrelated to the previous issue. > > > Why is it not related? this has got me confused. If a bloom filter has > all of the bits set to 1, then it will never filter any Tuples right? Because the false positive rate can be computed without having to look at the lookups. So it's inherently independent on the ordering of outer relation, and so on. > If so, then a filter with all 1 bits set should be thrown away, as > it'll never help us, and the filter should generally become more > worthwhile as it contains a higher ratio of 0 bits vs 1 bits. Of > course we don't have a count of how many Tuples matched each bit, so > this is based on the assumption that each bit matches an equal number > of Tuples. Are you saying this is not an assumption that we should > make? Sure we should check that. All I'm saying is it has nothing to do with the first problem described in the first part of the e-mail. 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