postgresql/src
David Rowley 44b5d56253 Tidy up code in get_cheapest_group_keys_order()
There are a few things that we could do a little better within
get_cheapest_group_keys_order():

1. We should be using list_free() rather than pfree() on a List.

2. We should use for_each_from() instead of manually coding a for loop to
skip the first n elements of a List

3. list_truncate(list_copy(...), n) is not a great way to copy the first n
elements of a list. Let's invent list_copy_head() for that.  That way we
don't need to copy the entire list just to truncate it directly
afterwards.

4. We can simplify finding the cheapest cost by setting the cheapest cost
variable to DBL_MAX.  That allows us to skip special-casing the initial
iteration of the loop.

Author: David Rowley
Discussion: https://postgr.es/m/CAApHDvrGyL3ft8waEkncG9y5HDMu5TFFJB1paoTC8zi9YK97Nw@mail.gmail.com
Backpatch-through: 15, where get_cheapest_group_keys_order was added.
2022-07-13 14:03:24 +12:00
..
backend Tidy up code in get_cheapest_group_keys_order() 2022-07-13 14:03:24 +12:00
bin Fix \watch's interaction with libedit on ^C. 2022-07-10 16:53:05 +12:00
common logging: Also add the command prefix to detail and hint messages 2022-05-30 07:26:06 +02:00
fe_utils Allow db.schema.table patterns, but complain about random garbage. 2022-04-20 11:37:29 -04:00
include Tidy up code in get_cheapest_group_keys_order() 2022-07-13 14:03:24 +12:00
interfaces libpq: Improve idle state handling in pipeline mode 2022-07-05 14:21:20 +02:00
makefiles
pl PL/Python: Update guide to alternative expected files 2022-06-27 12:53:05 +02:00
port
template
test Fix two portability issues with the tests of test_oat_hooks 2022-07-11 12:48:06 +09:00
timezone Update time zone data files to tzdata release 2022a. 2022-05-05 14:54:53 -04:00
tools expression eval: Fix EEOP_JSON_CONSTRUCTOR and EEOP_JSONEXPR size. 2022-07-05 11:26:27 -07:00
tutorial
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Update Unicode data to CLDR 41 2022-04-06 08:17:33 +02:00
Makefile.shlib
nls-global.mk