From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Cc: | Richard Guo <guofenglinux(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, "miroslav(dot)bendik(at)gmail(dot)com" <miroslav(dot)bendik(at)gmail(dot)com> |
Subject: | Re: Incremental sort for access method with ordered scan support (amcanorderbyop) |
Date: | 2023-04-20 21:33:20 |
Message-ID: | CAEudQAo4vEd+2+wGGthL1iAaWo3enFnoVaZOXmdb2UZsiab3ZQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>I searched the codes and found some other places where the manipulation
>of lists can be improved in a similar way.
>* lappend(list_copy(list), datum) as in get_required_extension().
>This is not very efficient as after list_copy it would need to enlarge
>the list immediately. It can be improved by inventing a new function,
>maybe called list_append_copy, that do the copy and append all together.
>* lcons(datum, list_copy(list)) as in get_query_def().
>This is also not efficient. Immediately after list_copy, we'd need to
>enlarge the list and move all the entries. It can also be improved by
>doing all these things all together in one function.
>* lcons(datum, list_delete_nth_cell(list_copy(list), n)) as in
>sort_inner_and_outer.
>It'd need to copy all the elements, and then delete the n'th entry which
>would cause all following entries be moved, and then move all the
>remaining entries for lcons. Maybe we can invent a new function for it?
>So is it worthwhile to improve these places?
I think yes. It's very inefficient coping and moving, unnecessarily.
Perhaps, like the attached patch?
lcons_copy_delete needs a careful review.
>I wonder if we can invent function list_nth_xid to do it, to keep
>consistent with list_nth/list_nth_int/list_nth_oid.
Perhaps list_nth_xid(const List *list, int n)?
regards,
Ranier Vilela
Attachment | Content-Type | Size |
---|---|---|
0001-add-new-list-functions.patch | application/octet-stream | 4.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2023-04-20 21:42:48 | Re: Incremental sort for access method with ordered scan support (amcanorderbyop) |
Previous Message | Tom Lane | 2023-04-20 21:21:08 | Re: LLVM strip -x fails |