[erlang-questions] Better way to check if a set of keys exists in a mnesia table?
Chaitanya Chalasani
cchalasani@REDACTED
Fri Jul 15 12:47:55 CEST 2016
I have a table with an UUID as the primary key / first element of the record.
What is the efficient way to check if a given set of UUIDs are valid primary key for that table.
I can think for three different solutions -
use mnesia:all_leys(TableName) and perform lists subset check. However, if the table contains over a million records, fetching all the keys for every check isn’t a nice solution.
use mnesia:read(TableName, Key) and check on the response. However, if the row is a big enough, trying to get the whole row for a simple key check isn’t that good either.
use ets:member(TableName, Key). A better solution than the above but doesn’t work on remote tables.
Which one of the above is the least bad solution or is there a better one hidden under the documents.
/Chaitanya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160715/629f08fa/attachment.htm>
More information about the erlang-questions
mailing list