Re: v12.0: ERROR: could not find pathkey item to sort - Mailing list pgsql-hackers

From David Rowley
Subject Re: v12.0: ERROR: could not find pathkey item to sort
Date
Msg-id CAKJS1f8PuKDqYZk=O+NrCcYgGdEkaCOwbUtSaPmhM8DaCfE-dg@mail.gmail.com
Whole thread Raw
In response to Re: v12.0: ERROR: could not find pathkey item to sort  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Thu, 31 Oct 2019 at 05:09, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> David --- much of the complexity here comes from the addition of
> the eclass_indexes infrastructure, so do you have any thoughts?

Hindsight makes me think I should have mentioned in the comment for
eclass_indexes that it's only used for simple rels and remains NULL
for anything else.

All the code in equivclass.c either uses get_common_eclass_indexes()
and get_eclass_indexes_for_relids() which go down to the simple rel
level to obtain their eclass_indexes. When calling
get_eclass_indexes_for_relids() we'll build a union Bitmapset with the
indexes from each simple rel that the join rel is made from. We only
ever directly use the eclass_indexes field when we're certain we're
dealing with a simple rel already. get_eclass_indexes_for_relids()
would do the same job, but using the field directly saves a bit of
needless effort and memory allocations. So, in short, I don't really
see why we need to set eclass_indexes for anything other than simple
rels.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Thoughts on nbtree with logical/varwidth table identifiers, v12on-disk representation
Next
From: Peter Geoghegan
Date:
Subject: Re: Thoughts on nbtree with logical/varwidth table identifiers, v12on-disk representation