Forum OpenACS Development: Response to CONNECT BY solution

Collapse
Posted by Don Baccus on
This strategy using LIKE doesn't scale well because the concat ("tree_sortkey || '%'") causes Postgres to not use the index (it can't because it has no way of knowing that tree_sortkey won't contain a non-trailing '%' or '_' character).

We've switched to using "between", along with a helper function.  Check out the sources for many examples - grep for "tree_sortkey between".