[erlang-questions] Spatial indexing in mnesia

Gleber gleber.p@REDACTED
Tue May 22 14:39:35 CEST 2007


I would like to revive this thread, because I'm interested in spatial indexing in mnesia. I've searched a lot of resources about Erlang and mnesia, and found nothing about R-trees implementation in Erlang or extending mnesia with spatial indexing.

I've done no hacking into mnesia yet. I'm not interested in full-blown spatial extension for mnesia, though my thoughts go into the following direction:
- let have two tables - "header" table and "data" table
- header table will have at least two columns - one with tuple of four floats (bounding box of given spatial object) and one with ID of row in "data" table
- a spatial index (using R-tree) will be built in memory (without writing to disk), thus this index will be available only for ram-only and ram-disk tables
- spatial queries will be run using this index on "header" table and list of IDs will be returned, it will be filtered on client side and then proper spatial data will be fetched from "data" table

If I'm not mistaken mnesia is capable of storing list of tuples in a single column, i.e. [{0, 0}, {99.5, 111.33333}, ...], so it is suitable for simple spatial objects. Am I right?

Now my questions. Does anyone done anything similar before? Is it possible to implement at all? Will this architecture be efficient? May anyone point me some documentation about an implementation of indecies in mnesia? I will be thankful for any information about this topic.

Shawn, David, have you done any research on the topic? 

Gleb Peregud
Post sent from http://www.trapexit.org

More information about the erlang-questions mailing list