Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Postgresql Intarray? #102

johnrees opened this Issue · 4 comments

5 participants


Has intarray been considered as an option for the ancestry field type when using postgres?

As far as I can tell the order is significant and it can be indexed so should be fast in comparison to string filtering. adds native support to Rails for it and I think I read somewhere that it might be included by default in Rails 4.0?


Interesting! If Rails 4 includes it by default, it may be a good choice to include it. On the other hand we prefer to keep dependencies to a minimum, so do not expect inclusion of the feature very soon.


This gem looks great. When reading through the documentation, however, the only thing that gave me pause was: "[ancestry] uses a ‘like’ condition in order to fetch descendants".

I think using an indexed array for the materialized paths would be awesome.

Edit: just came across an article talking about how they do just that at DISQUS:


Postgres has a much better option than intarray, that is a string (dot-separated ids) with a ltree index. It naturally supports prefix and other type of searches, and it is thought explicitly for trees.


+1 for postgres ltree support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.