Search code examples
erlangetsdets

Mostly read only use of DETS


So I have been using ETS - works great. However, I use it as a cache of route data - which I load when the module loads, and save when a change is made (it is read far more than written).

I was thinking that DETS would make things much cleaner - I don't have to worry about managing the persistence of the table. Would this be a good use of DETS? (size isn't an issue, mostly concerned about major increase in read performance - all the data can easily fit in memory).


Solution

  • DETS is much much slower than ETS in most cases but I guess that if your data size is small then most if it will be cached by the disk cache and will be faster to retrieve the second time you read it, so the best thing is the try it with your type of use

    But have you considered using Mnesia instead of ETS directly? With the Mnesia table type disc_copies you will get the speed of ETS and still persistency