Why has_useful_pathkeys() needs to check group_pathkeys

Started by Richard Guoabout 1 year ago1 messageshackers

Thread notes

1 note#discussion
hackorum-bot#discussion
hackorum-bot
1 day ago

@global #discussion

#discussion
Jump to latest
#1Richard Guo
guofenglinux@gmail.com

While reviewing the recent changes in truncate_useless_pathkeys(), I
noticed the nearby function has_useful_pathkeys(), and I'm a bit
confused. It makes sense to check whether the given relation is
involved in joins or whether root->query_pathkeys is nonempty, but I
don't understand the need to specifically check root->group_pathkeys.

If the intention is to check whether there are useful pathkeys for
grouping, I think checking root->query_pathkeys is sufficient. This
is because when group_pathkeys is nonempty, standard_qp_callback()
ensures that query_pathkeys is also nonempty.

'git log' shows that the check for root->group_pathkeys was introduced
in commit 0452b461b. So cc'ing Alexander.

- Richard