Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Postgresql Intarray? #102

Open
johnrees opened this Issue · 4 comments

5 participants

@johnrees

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

http://www.postgresql.org/docs/9.1/static/intarray.html

As far as I can tell the order is significant and it can be indexed so should be fast in comparison to string filtering.

https://github.com/dockyard/postgres_ext adds native support to Rails for it and I think I read somewhere that it might be included by default in Rails 4.0?

@vanderhoorn
Collaborator

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.

@phaedryx

+1
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: http://justcramer.com/2012/04/08/using-arrays-as-materialized-paths-in-postgres/

@rewritten

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.

@andyl

+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.