<div dir="ltr"><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">Hello,</span><div style="margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></div><div style="margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif;font-size:13px">I have been using Mondrian 4 with Saiku as an OLAP engine. Mondrian is integrated with apache phoenix (version 4.6) as the data source that used apache hbase as the data store. In order to speed up the queries I am trying to make pre-aggregated tables work but for some reason the actual fact table is getting queried. Here&#39;s how the mondrian schema definition looks like - <a href="http://pastebin.com/xquutKYX" target="_blank" rel="nofollow" style="margin:0px;padding:0px;border:0px;text-decoration:none;color:rgb(102,17,204)">http://pastebin.com/xquutKYX</a>.</div><div style="margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></div><div style="margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif;font-size:13px">The database schema for the dimension, facts and the pre-aggregated table is shared here - <a href="http://pastebin.com/EWhyNLTJ" target="_blank" rel="nofollow" style="margin:0px;padding:0px;border:0px;text-decoration:none;color:rgb(102,17,204)">http://pastebin.com/EWhyNLTJ</a></div><div style="margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></div><div style="margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif;font-size:13px">Selecting the total sales measure and the agent id as a row in the saiku builds up a query and tries to execute it on the facts table instead of the pre-aggregated table. The query from the sql logs is</div><div style="margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></div><div style="margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif;font-size:13px">DEBUG [mondrian.sql] 850: Segment.load: executing sql [select &quot;AGENTS&quot;.&quot;A_ID&quot; as &quot;c0&quot;, sum(&quot;TRANSACTIONS&quot;.&quot;TOTAL_SALES&quot;) as &quot;m0&quot; from &quot;TRANSACTIONS&quot; as &quot;TRANSACTIONS&quot;, &quot;AGENTS&quot; as &quot;AGENTS&quot; where &quot;TRANSACTIONS&quot;.&quot;AGENT_ID&quot; = &quot;AGENTS&quot;.&quot;A_ID&quot; group by &quot;AGENTS&quot;.&quot;A_ID&quot;]<br></div><div style="margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></div><div style="margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif;font-size:13px">What could be missing in order to make the OLAP engine to use the AG_TER_PRO (pre-aggregated table)?</div><div style="margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></div><div style="margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif;font-size:13px">Thanks,</div><div style="margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif;font-size:13px">Amit.</div></div>