Use list_copy_head() instead of list_truncate(list_copy(...), ...)
David Rowley <drowley@postgresql.org>
Use list_copy_head() instead of list_truncate(list_copy(...), ...) Truncating off the end of a freshly copied List is not a very efficient way of copying the first N elements of a List. In many of the cases that are updated here, the pattern was only being used to remove the final element of a List. That's about the best case for it, but there were many instances where the truncate trimming the List down much further. 4cc832f94 added list_copy_head(), so let's use it in cases where it's useful. Author: David Rowley Discussion: https://postgr.es/m/1986787.1657666922%40sss.pgh.pa.us
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/catalog/objectaddress.c | modified | +4 −4 |
| src/backend/commands/dropcmds.c | modified | +7 −8 |
| src/backend/commands/sequence.c | modified | +1 −1 |
| src/backend/optimizer/path/allpaths.c | modified | +4 −5 |
| src/backend/optimizer/path/indxpath.c | modified | +6 −8 |
| src/backend/optimizer/path/pathkeys.c | modified | +1 −1 |
| src/backend/optimizer/plan/createplan.c | modified | +2 −3 |
Discussion
- Some clean-up work in get_cheapest_group_keys_order() 5 messages · 2022-07-12 → 2022-07-13