Edmund Horner <ejr...@gmail.com> writes: > Ok. I think that will simplify things. So if I follow you correctly, > we should do:
> 1. If has_useful_pathkeys is true: generate pathkeys (for CTID ASC), > and use truncate_useless_pathkeys on them. > 2. If we have tid quals or pathkeys, emit a TID scan path. Check. > For the (optional) backwards scan support patch, should we separately > emit another path, in the reverse direction? What indxpath.c does is, if has_useful_pathkeys is true, to generate pathkeys both ways and then build paths if the pathkeys get past truncate_useless_pathkeys. That seems sufficient in this case too. There are various heuristics about whether it's really useful to consider both sort directions, but that intelligence is already built into truncate_useless_pathkeys. tid quals with no pathkeys would be reason to generate a forward path, but not reason to generate a reverse path, because then that would be duplicative. regards, tom lane