<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">


<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="cid:filelist.xml@01C3D176.4FADC440">
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PersonName"/>
<!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:HyphenationZone>21</w:HyphenationZone>
  <w:EnvelopeVis/>
  <w:Compatibility>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:ApplyBreakingRules/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0pt;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;
        text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;
        text-underline:single;}
p
        {mso-margin-top-alt:auto;
        margin-right:0pt;
        mso-margin-bottom-alt:auto;
        margin-left:0pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
span.EstiloCorreo17
        {mso-style-type:personal-compose;
        mso-style-noshow:yes;
        mso-ansi-font-size:10.0pt;
        mso-bidi-font-size:10.0pt;
        font-family:Arial;
        mso-ascii-font-family:Arial;
        mso-hansi-font-family:Arial;
        mso-bidi-font-family:Arial;
        color:windowtext;}
span.SpellE
        {mso-style-name:"";
        mso-spl-e:yes;}
span.GramE
        {mso-style-name:"";
        mso-gram-e:yes;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 85.05pt 70.85pt 85.05pt;
        mso-header-margin:35.4pt;
        mso-footer-margin:35.4pt;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */ 
 table.MsoNormalTable
        {mso-style-name:"Tabla normal";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0pt 5.4pt 0pt 5.4pt;
        mso-para-margin:0pt;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";}
</style>
<![endif]-->
</head>

<body lang=ES link=blue vlink=purple style='tab-interval:35.4pt'>

<div class=Section1>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'>Hi,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'>I hope someone can give as
some help about this issue. We are trying to optimize <span class=SpellE>mnesia</span>
access time, to phone tariff tables.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'>This tariff tables, have about
4000 entries each.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'> </span>The index is a <span class=SpellE>tuple</span>
key as follows:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'>{“<span class=SpellE>Tariff_Table_Name”,”Prefix</span>”}<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><span class=GramE><b style='mso-bidi-font-weight:normal'><font
size=3 face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt;
mso-ansi-language:EN-GB;font-weight:bold;mso-bidi-font-weight:normal'>where</span></font></b></span><b
style='mso-bidi-font-weight:normal'><span lang=EN-GB style='mso-ansi-language:
EN-GB;font-weight:bold;mso-bidi-font-weight:normal'> </span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><span class=SpellE><font size=3 face="Times New Roman"><span
lang=EN-GB style='font-size:12.0pt;mso-ansi-language:EN-GB'>Tariff_Table_Name</span></font></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'>, is the name of the Tariff plan
that applies to the subscriber<o:p></o:p></span></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><b><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB;font-weight:bold'>And<o:p></o:p></span></font></b></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'>Prefix, is a string, the first
digits of the called number. <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'>So our queries are (Tariff
Table Name=”TARIFF”):<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><span class=SpellE><font size=2 face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>MatchHead</span></font></span><font
size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'> = #<span class=SpellE><span class=GramE>tarifftable</span></span><span
class=GramE>{</span><span class=SpellE>tarifftablekey</span>='$1', _='_'},<br>
 Guard = [{'=='<span class=GramE>,{</span>element,1,'$1'},
"TARIFF"}],<br>
 Result = '$1',<br>
 Select = <span class=GramE>fun(</span>) -><br>
              
<span class=SpellE><span class=GramE>mnesia:</span>select</span>(<span
class=SpellE>tarifftable</span>,[{<span class=SpellE>MatchHead</span>, Guard,
[Result]}])<br>
           <span class=GramE>end</span>,<br>
<br>
 {<span class=GramE>atomic</span>, <span class=SpellE>Res</span>} = <span
class=SpellE>mnesia<span class=GramE>:transaction</span></span>(Select),<br>
 <span class=GramE>Res.</span><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'>So, as a result, it brings
4000 <span class=SpellE>tuples</span>, of the form “{“<span
class=SpellE>Tariff_Table_Name”,”Prefix</span>”}<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'>Later the application searches
for the “prefix” that better <span class=SpellE>martches</span> the
called number (the prefix is a substring of the called number). My question is,
instead of bringing all 4000 <span class=SpellE>tuples</span>, can I bring just
the most similar “Prefix”, like the one which have <span
class=GramE>an</span> specific first <span class=SpellE>caracter</span>? So
instead of bringing 4000 <span class=SpellE>tuples</span>, I may bring just the
most similar ones (the prefixes which are more similar to the destination
number?)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'>Best Regar</span></font><st1:PersonName><span
 lang=EN-GB style='mso-ansi-language:EN-GB'>ds</span></st1:PersonName><span
lang=EN-GB style='mso-ansi-language:EN-GB'>,<o:p></o:p></span></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><span class=SpellE><span class=GramE><font size=3
face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt;mso-ansi-language:
EN-GB'>daniel</span></font></span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

</div>

</body>

</html>