Re: WIP: BRIN multi-range indexes
Tomas Vondra <tomas.vondra@enterprisedb.com>
From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: John Naylor <john.naylor@enterprisedb.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-01-26T22:59:05Z
Lists: pgsql-hackers
On 1/26/21 7:52 PM, John Naylor wrote: > On Fri, Jan 22, 2021 at 10:59 PM Tomas Vondra > <tomas.vondra@enterprisedb.com <mailto:tomas.vondra@enterprisedb.com>> > 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
Commits
-
BRIN minmax-multi indexes
- ab596105b55f 14.0 landed
-
BRIN bloom indexes
- 77b88cd1bb90 14.0 landed
-
Support the old signature of BRIN consistent function
- a681e3c107aa 14.0 landed
-
Remove unnecessary pg_amproc BRIN minmax entries
- a68dfa27d42f 14.0 landed
-
Optimize allocations in bringetbitmap
- 8e4b332e88b8 14.0 landed
-
Move IS [NOT] NULL handling from BRIN support functions
- 72ccf55cb99c 14.0 landed
-
Pass all scan keys to BRIN consistent function at once
- a1c649d889bd 14.0 landed
-
Properly detoast data in brin_form_tuple
- d2d3a4bd33d2 9.5.24 landed
- bae31e75f777 9.6.20 landed
- 0b96fc977c5b 10.15 landed
- 895d0f0e8218 11.10 landed
- 8149e9f9a0d6 12.5 landed
- 6a7b55f3716f 13.1 landed
- 7577dd84807a 14.0 landed