> On Thu, Jul 25, 2019 at 1:21 PM Kyotaro Horiguchi <horikyota....@gmail.com> > wrote: > > I feel uncomfortable to look into indexinfo there. Couldnd't we > use indexskipprefix == -1 to signal !amcanskip from > create_index_path?
Looks like it's not that straightforward to do this only in create_index_path, since to make this decision we need to have both parts, indexinfo and distinct keys. > Yeah, your explanation was perfect for me. What I failed to > understand was what is expected to be done in the case. I > reconsidered and understood that: > > For example, the following query: > > select distinct (a, b) a, b, c from t where c < 100; > > skip scan returns one tuple for one distinct set of (a, b) with > arbitrary one of c, If the choosed c doesn't match the qual and > there is any c that matches the qual, we miss that tuple. > > If this is correct, an explanation like the above might help. Yes, that's correct, I've added this into commentaries. > Maybe something like the following will work *for me*:p > > | When we are fetching a cursor in backward direction, return the > | tuples that forward fetching should have returned. In other > | words, we return the last scanned tuple in a DISTINCT set. Skip > | to that tuple before returning the first tuple. And this too (slightly rewritten:). We will soon post the new version of patch with updates about UniqueKey from Jesper.