Re: WIP: BRIN multi-range indexes
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: John Naylor <john.naylor@2ndquadrant.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2020-09-09T19:53:30Z
Lists: pgsql-hackers
On 2020-Sep-09, Tomas Vondra wrote: > There are some minor optimizations possible - for example I noticed we > call minmax_multi_get_strategy_procinfo often because it happens in a > loop, and we could easily do it just once. But that saves only about 10% > or so, it's not a ground-breaking optimization. Well, I guess this kind of thing should be fixed regardless while we still know it's there, just to avoid an obvious inefficiency. > The main reason for the slowness is that we pass the values one by one > to brin_minmax_multi_add_value - and on each call we need to deserialize > (and then sometimes also serialize) the summary, which may be quite > expensive. The regular minmax does not have this issue, it just swaps > the Datum value and that's it. Ah, right, that's more interesting. The original dumb BRIN code separates BrinMemTuple from BrinTuple so that things can be operated efficiently in memory. Maybe something similar can be done in this case, which also sounds like your second suggestion: > Another option would be to teach add_value to keep the deserialized > summary somewhere, and then force serialization at the end of the BRIN > page range. The end result would be roughly the same, I think. Also, I think you could get a few initial patches pushed soon, since they look like general improvements rather than specific to multi-range. On a differen train of thought, I wonder if we shouldn't drop the idea of there being two minmax opclasses; just have one (still called "minmax") and have the multi-range version be the v2 of it. We would still need to keep code to operate on the old one, but if you ever REINDEX then your index is upgraded to the new one. I see no reason to keep the dumb minmax version around, assuming the performance is roughly similar. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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