I have two records:
-record(foo, {timestamp, name}).
-record(bar, {timestamp, name}).
And I would like to execute a Mnesia query that mimics the following SQL query
SELECT f.* FROM foo f WHERE f.timestamp NOT IN ( SELECT b.timestamp FROM boo b)
What would be an efficient Mnesia equivalent?
Good Question ! Now, i have thought of two ways. One where we use
qlc
and another where we usemnesia's own table iteration methods with accumulators
. Here is the first option:Another option would be to iterate table
foo
while cross referencing each timestamp in the tablebar
. If its not found inbar
then its added to the accumulated amount. look at this belowI guess depending on the table size, the application and the user preference, each of these functions will have consequences. However, try both of them and see which one blends well into your app. The good thing is that this is entirely a read job, no writes, so i expect to be efficient enough. Success !