<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 2/19/12 3:46 PM, Ward Bekker wrote:
<blockquote cite="mid:20120219144655.dfe0d59d@groupware.tty.nl"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<style>BODY{font:10pt Tahoma,Verdana,sans-serif} .MsoNormal{line-height:120%;margin:0}</style>
<span class="Apple-style-span" style="border-collapse: collapse;
font-family: Arial, 'Liberation Sans', 'DejaVu Sans',
sans-serif; font-size: 14px; line-height: 18px; ">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom:
1em; margin-left: 0px; padding-top: 0px; padding-right: 0px;
padding-bottom: 0px; padding-left: 0px; border-top-width: 0px;
border-right-width: 0px; border-bottom-width: 0px;
border-left-width: 0px; border-style: initial; border-color:
initial; font-size: 14px; vertical-align: baseline;
background-image: initial; background-attachment: initial;
background-origin: initial; background-clip: initial;
background-color: transparent; clear: both; word-wrap:
break-word; background-removed-by-webmail: initial initial;
background-repeat: initial initial; ">Hi,</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom:
1em; margin-left: 0px; padding-top: 0px; padding-right: 0px;
padding-bottom: 0px; padding-left: 0px; border-top-width: 0px;
border-right-width: 0px; border-bottom-width: 0px;
border-left-width: 0px; border-style: initial; border-color:
initial; font-size: 14px; vertical-align: baseline;
background-image: initial; background-attachment: initial;
background-origin: initial; background-clip: initial;
background-color: transparent; clear: both; word-wrap:
break-word; background-removed-by-webmail: initial initial;
background-repeat: initial initial; ">I have two records:</p>
<pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; overflow-x: auto; overflow-y: auto; width: auto; max-height: 600px; background-removed-by-webmail: initial initial; background-repeat: initial initial; "><code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; bord
er-top-wi
dth: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; background-removed-by-webmail: initial initial; background-repeat: initial initial; ">-record(foo, {timestamp, name}).
-record(bar, {timestamp, name}).
</code></pre>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom:
1em; margin-left: 0px; padding-top: 0px; padding-right: 0px;
padding-bottom: 0px; padding-left: 0px; border-top-width: 0px;
border-right-width: 0px; border-bottom-width: 0px;
border-left-width: 0px; border-style: initial; border-color:
initial; font-size: 14px; vertical-align: baseline;
background-image: initial; background-attachment: initial;
background-origin: initial; background-clip: initial;
background-color: transparent; clear: both; word-wrap:
break-word; background-removed-by-webmail: initial initial;
background-repeat: initial initial; ">And I would like to
execute a Mnesia query that mimics the following SQL query</p>
<pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; overflow-x: auto; overflow-y: auto; width: auto; max-height: 600px; background-removed-by-webmail: initial initial; background-repeat: initial initial; "><code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; bord
er-top-wi
dth: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; background-removed-by-webmail: initial initial; background-repeat: initial initial; ">SELECT f.* FROM foo f WHERE f.timestamp NOT IN ( SELECT b.timestamp FROM boo b)
</code></pre>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom:
1em; margin-left: 0px; padding-top: 0px; padding-right: 0px;
padding-bottom: 0px; padding-left: 0px; border-top-width: 0px;
border-right-width: 0px; border-bottom-width: 0px;
border-left-width: 0px; border-style: initial; border-color:
initial; font-size: 14px; vertical-align: baseline;
background-image: initial; background-attachment: initial;
background-origin: initial; background-clip: initial;
background-color: transparent; clear: both; word-wrap:
break-word; background-removed-by-webmail: initial initial;
background-repeat: initial initial; ">What would be an
efficient Mnesia equivalent?</p>
</span><br>
</blockquote>
It depends on which indexes you have in your fine SQL database :)
But writing a QLC (Query List Comprehension) containing a subselect
should be possible without too much work. The question is if you get
a decent efficiency out of it. Which is where the indexes comes into
play. If you need this a lot, then you may need to organize your
data in a shape that makes it efficient. The point of mnesia is that
it works much like a modern K/V (NoSQL) store in its performance
metrics - so you need to think about the shape of data to get it to
run fast.<br>
<pre class="moz-signature" cols="72">--
Jesper Louis Andersen
Erlang Solutions Ltd., Copenhagen, DK</pre>
</body>
</html>