Skip to content

Instantly share code, notes, and snippets.

@maierru
maierru / ets select is slow.txt
Last active August 27, 2017 11:34
ETS select is slow => O(n)
https://github.com/sat2707/hlcupdocs/blob/master/TECHNICAL_TASK.md
iex(9)> :ets.info(:visits)
[read_concurrency: true, write_concurrency: false, compressed: false,
memory: 110008228, owner: #PID<0.3544.0>, heir: :none, name: :visits,
size: 10000740, node: :nonode@nohost, named_table: true, type: :ordered_set,
keypos: 1, protection: :public]
iex(11)> fun = :ets.fun2ms(fn {id, user, location, visited_at, mark} when user == 475422 -> id end)
[{{:"$1", :"$2", :"$3", :"$4", :"$5"}, [{:==, :"$2", 475422}], [:"$1"]}]