Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l4XIq-0007cW-71 for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Jan 2021 22:59:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l4XIo-0004Im-Us for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Jan 2021 22:59:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l4XIo-0004Ie-Jf for pgsql-hackers@lists.postgresql.org; Tue, 26 Jan 2021 22:59:14 +0000 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l4XIl-00022P-5x for pgsql-hackers@lists.postgresql.org; Tue, 26 Jan 2021 22:59:13 +0000 Received: by mail-ed1-x52a.google.com with SMTP id d2so59952edz.3 for ; Tue, 26 Jan 2021 14:59:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-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=AYccPSX7IYHGtZ0tFTf9pCrJzJR4nGD4oLElTkCUBOw=; b=pcobSJsR6PqjWpPD6XLMdIPHxxGqmAB3ac7SUTi1R3+i4YzQwajFA7FPmNeQ4o46k6 KfIuK0JxMzcQQHAEO9bKskl+ENf4afvEgAjG+z27iraq46akX9JE8K8lrsEpa1yiwOYv UdTxAEurqCIA69gqJZBXKl/3vZzzFmrMLuSLG76KuXj365uGoBnDd05bEYEB6ZlBywlj uzuGzbzCnFslYuf0CJP4ZASc4iBcaTz6tjgGpo7b5xFMDGGR8NQ5ZCEmEdqOXkf0CYuJ 8zKk55oO7rc9Uj3cyv4YqF70ebAlYjhmWvJGmNG4jiFv66+LbPO27tRJrkniWbAW2rpK 6YiQ== 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=AYccPSX7IYHGtZ0tFTf9pCrJzJR4nGD4oLElTkCUBOw=; b=mk1x6IyAwvhPQUvA8E4Cq/6qRy1wyyFJXx4jqOlkJzXx4vdsTBD06q47N2D4GBZYBa Z6cCQT0b0soi9ixbeoFz4796RyehKQ526HeHO/kPW5xTK6Oau2ICT2O0twz/Xo/5w3tb poQIMeTiNvjyaI4gNnQN70oGOavWOSAuQ1jRBrBkqobs1TWECtrYlQ3pOsq0tXFQVtYy vA+F1nF2I/GD/j1KkhOsnMEUK8Yv5vCoGcDXuTUIrOZD81/BGPNexuCcjuKvRoF7nvK4 04HIVHlUYmduk8fP/1bazUwPl51FMvwY+w9qOJeoNV0/ucnJgU4YEzfebJs27nJ3+0rW hpvA== X-Gm-Message-State: AOAM530RYT6z3NuDOSlHnpHgj7/ht+sgLtx8tmXCZq3OYZkCEXJjS/3I WBFJn8iMblLA25gVQhKRNnPYZoncLmswrwxo12h/yEYkl1DPf0fyzVJPEuBIplAX3qJmCuJDlsm hzF2WtFpxgZxrgi1cW8VvtFvmULK1p9V/Ja8Kz22cIbU9sgf5qzCeGIDiN70C+cgajMlJUL/Hxx aR0AVg/El/Wqff11rHk/aDSGBjKmHSg87HAc2ucSHm0Lo3fFSmurnGbFGZf/NmVPqYdydtahlDY aLffAKo3BgSsVmDmPjn2M3Rb3yPUGmyvAlErcpkHOqzVumYi5qMTg== X-Google-Smtp-Source: ABdhPJwP/34iwS7+4h+Q4RHNovMeTPeN3alldfF8JBOno6CGx7NxMy9bF9Kl5RlVt6thVE8biOZbpA== X-Received: by 2002:a50:85c4:: with SMTP id q4mr6299796edh.7.1611701949068; Tue, 26 Jan 2021 14:59:09 -0800 (PST) Received: from [10.137.0.20] (ip-86-49-253-127.net.upcbroadband.cz. [86.49.253.127]) by smtp.gmail.com with ESMTPSA id v25sm113419edx.49.2021.01.26.14.59.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Jan 2021 14:59:08 -0800 (PST) Subject: Re: WIP: BRIN multi-range indexes To: John Naylor Cc: PostgreSQL Hackers References: <160434032777.4948.12542847889193566385.pgcf@coridan.postgresql.org> <20201102232545.zw4xir577gq55ogj@development> <88b3831d-8afa-4135-a420-27b12bf9fae4@enterprisedb.com> <1fdcbd2a-ff0f-fb81-d227-22279d5cbcb7@enterprisedb.com> <061b24c0-87eb-51a7-17d6-e1ba8c59fd23@enterprisedb.com> <8a40b7e4-357e-b0c2-e8b7-72001993fc32@enterprisedb.com> <2e903689-c518-f77d-551a-5e3e279d0838@enterprisedb.com> From: Tomas Vondra Message-ID: Date: Tue, 26 Jan 2021 23:59:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/26/21 7:52 PM, John Naylor wrote: > On Fri, Jan 22, 2021 at 10:59 PM Tomas Vondra > > > wrote: > > > > > > On 1/23/21 12:27 AM, John Naylor wrote: > > > > Still, it would be great if multi-minmax can be a drop in > replacement. I > > > know there was a sticking point of a distance function not being > > > available on all types, but I wonder if that can be remedied or worked > > > around somehow. > > > > > > > Hmm. I think Alvaro also mentioned he'd like to use this as a drop-in > > replacement for minmax (essentially, using these opclasses as the > > default ones, with the option to switch back to plain minmax). I'm not > > convinced we should do that - though. Imagine you have minmax indexes in > > your existing DB, it's working perfectly fine, and then we come and just > > silently change that during dump/restore. Is there some past example > > when we did something similar and it turned it to be OK? > > I was assuming pg_dump can be taught to insert explicit opclasses for > minmax indexes, so that upgrade would not cause surprises. If that's > true, only new indexes would have the different default opclass. > Maybe, I suppose we could do that. But I always found such changes happening silently in the background a bit suspicious, because it may be quite confusing. I certainly wouldn't expect such difference between creating a new index and index created by dump/restore. Did we do such changes in the past? That might be a precedent, but I don't recall any example ... > > As for the distance functions, I'm pretty sure there are data types > > without "natural" distance - like most strings, for example. We could > > probably invent something, but the question is how much we can rely on > > it working well enough in practice. > > > > Of course, is minmax even the right index type for such data types? > > Strings are usually "labels" and not queried using range queries, > > although sometimes people encode stuff as strings (but then it's very > > unlikely we'll define the distance definition well). So maybe for those > > types a hash / bloom would be a better fit anyway. > > Right. > > > But I do have an idea - maybe we can do without distances, in those > > cases. Essentially, the primary issue of minmax indexes are outliers, so > > what if we simply sort the values, keep one range in the middle and as > > many single points on each tail? > > That's an interesting idea. I think it would be a nice bonus to try to > do something along these lines. On the other hand, I'm not the one > volunteering to do the work, and the patch is useful as is. > IMO it's fairly small amount of code, so I'll take a stab at in in the next version of the patch. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company