Re: POC: converting Lists into arrays
Tom Lane <tgl@sss.pgh.pa.us>
Andres Freund <andres@anarazel.de> writes: > On 2019-03-02 18:11:43 -0500, Tom Lane wrote: >> I wonder what test cases Andres has been looking at that convince >> him that we need a reimplementation of Lists. > My main observation was from when the expression evaluation was using > lists all over. List iteration overhead was very substantial there. But > that's not a problem anymore, because all of those are gone now due to > the expression rewrite. I personally wasn't actually advocating for a > new list implementation, I was/am advocating that we should move some > tasks over to a more optimized representation. I doubt that you'll get far with that; if this experiment is anything to go by, it's going to be really hard to make the case that twiddling the representation of widely-known data structures is worth the work and bug hazards. > I still regularly see list overhead matter in production workloads. A > lot of it being memory allocator overhead, which is why I'm concerned > with a rewrite that doesn't reduce the number of memory allocations. Well, I did that in the v3 patch, and it still hasn't moved the needle noticeably in any test case I've tried. At this point I'm really struggling to see a reason why we shouldn't just mark this patch rejected and move on. If you have test cases that suggest differently, please show them don't just handwave. The cases I've been looking at suggest to me that we'd make far more progress on the excessive-palloc'ing front if we could redesign things to reduce unnecessary copying of parsetrees. Right now the planner does an awful lot of copying because of fear of unwanted modifications of multiply-linked subtrees. I suspect that we could reduce that overhead with some consistently enforced rules about not scribbling on input data structures; but it'd take a lot of work to get there, and I'm afraid it'd be easily broken :-( regards, tom lane
Commits
-
Remove EState.es_range_table_array.
- 3c926587b592 13.0 landed
-
Rationalize use of list_concat + list_copy combinations.
- 5ee190f8ec37 13.0 landed
-
Cosmetic improvements in setup of planner's per-RTE arrays.
- 1661a4050593 13.0 landed
-
Make better use of the new List implementation in a couple of places
- efdcca55a3df 13.0 landed
-
Fix sepgsql test results for commit d97b714a2.
- 82c8a3c52adf 13.0 landed
-
Avoid using lcons and list_delete_first where it's easy to do so.
- d97b714a2199 13.0 landed
-
Remove lappend_cell...() family of List functions.
- c245776906b0 13.0 landed
-
Clean up some ad-hoc code for sorting and de-duplicating Lists.
- 2f5b8eb5a28b 13.0 landed
-
Redesign the API for list sorting (list_qsort becomes list_sort).
- 569ed7f48312 13.0 landed
-
Remove dead code.
- 4c3d05d875dd 13.0 landed
-
Represent Lists as expansible arrays, not chains of cons-cells.
- 1cff1b95ab6d 13.0 landed
-
Standardize some more loops that chase down parallel lists.
- c94fb8e8acc0 12.0 landed
-
Reimplement the linked list data structure used throughout the backend.
- d0b4399d81f3 8.0.0 cited