Re: WIP: BRIN multi-range indexes
John Naylor <john.naylor@enterprisedb.com>
From: John Naylor <john.naylor@enterprisedb.com>
To: Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-02-22T20:16:08Z
Lists: pgsql-hackers
On Mon, Feb 15, 2021 at 10:37 AM Tomas Vondra <tomas.vondra@enterprisedb.com> wrote: > [v20210215] Hi Tomas, This time I only looked at the cumulative changes in the multiminmax opclass, since I'm pretty sure all the bloom issues have been addressed. * XXX CombineRange name seems a bit weird. Consider renaming, perhaps to * something ExpandedRange or so. The time to do it is now, if you like, or remove the XXX. I agree with the comment, FWIW. In has_matching_range(): * So we know it's in the general min/max, the question is whether it * falls in one of the ranges or gaps. We'll use a binary search on * the ranges. * * it's in the general range, but is it actually covered by any * of the ranges? Repeat the check for each range. * * XXX We simply walk the ranges sequentially, but maybe we could * further leverage the ordering and non-overlap and use bsearch to * speed this up a bit. It looks to me like you already implemented binary search and the last part is out of date, or am I missing something? Same in range_contains_value(): * XXX This might benefit from the fact that both the intervals and exact * values are sorted - we might do bsearch or something. Currently that * does not make much difference (there are only ~32 intervals), but if * this gets increased and/or the comparator function is more expensive, * it might be a huge win. Below that it does binary search if the number of elements > 16. In merge_combine_ranges(): There are a couple assert-related TODOs. In brin_minmax_multi_distance_timetz(): * XXX Does this need to consider the time zones? I wouldn't think so, because the stored values are in UTC -- the time zone calculation only happens during storage and retrieval, and they've already been stored, IIUC. Also, I think you need to copy this part from brin_minmax_multi_distance_timestamp() here as well: if (TIMESTAMP_NOT_FINITE(dt1) || TIMESTAMP_NOT_FINITE(dt2)) PG_RETURN_FLOAT8(0); At this point, I think it's pretty close to commit-ready. I thought maybe I would create a small index with every type, and make sure it looks sane in page_inspect, but that's about it. -- John Naylor EDB: http://www.enterprisedb.com
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