How to create index for quick access in clojure hash table?

I want to store many records in a clojure hash table. If I want to get quick access to certain records using a specific field or range query, then what parameters do I have, without having to resort to storing data in a database (from where the data came first).

I think I'm also wondering if STM is suitable for a large indexed dataset.

+3
source share
2 answers

You will probably want to create separate indexes for each field using sorted-map so that you can perform range queries. Under the hood, it uses something like a permanent version of Java TreeMap.

STM , . , , :

  • .
+2

, , . , Java Java (Derby, H2 ..).

, Clojure. Clojure O (log32 n) (, , ). , Java, HashMap ConcurrentHashMap , Clojure. - ... Java ConcurentSkipListMap, , . , btree impl.

, Clojure STM . ? , , Ehcache ( ).

- , .

+5

Source: https://habr.com/ru/post/1782761/


All Articles