<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Dave's Adventures in Business Intelligence &#187; 2007 Insight Americas</title>
	<atom:link href="http://www.dagira.com/category/conferences/insight-americas-2007/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dagira.com</link>
	<description>...you are in a twisty maze of passageways, all different...</description>
	<lastBuildDate>Wed, 01 Feb 2012 17:26:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<!-- podcast_generator="podPress/8.8" -->
		<copyright>&#xA9; </copyright>
		<managingEditor>blogmaster@dagira.com ()</managingEditor>
		<webMaster>blogmaster@dagira.com()</webMaster>
		<category></category>
		<ttl>1440</ttl>
		<itunes:keywords></itunes:keywords>
		<itunes:subtitle></itunes:subtitle>
		<itunes:summary>...you are in a twisty maze of passageways, all different...</itunes:summary>
		<itunes:author></itunes:author>
		<itunes:category text="Society &amp; Culture"/>
		<itunes:owner>
			<itunes:name></itunes:name>
			<itunes:email>blogmaster@dagira.com</itunes:email>
		</itunes:owner>
		<itunes:block>No</itunes:block>
		<itunes:explicit>no</itunes:explicit>
		<itunes:image href="http://www.dagira.com/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<image>
			<url>http://www.dagira.com/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
			<title>Dave's Adventures in Business Intelligence</title>
			<link>http://www.dagira.com</link>
			<width>144</width>
			<height>144</height>
		</image>
		<item>
		<title>Index Awareness Part I: The Basics</title>
		<link>http://www.dagira.com/2007/10/26/index-awareness-part-i-the-basics/</link>
		<comments>http://www.dagira.com/2007/10/26/index-awareness-part-i-the-basics/#comments</comments>
		<pubDate>Fri, 26 Oct 2007 21:26:57 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[2007 Insight Americas]]></category>
		<category><![CDATA[Universe Design]]></category>

		<guid isPermaLink="false">http://www.dagira.com/2007/10/26/index-awareness-part-i-the-basics/</guid>
		<description><![CDATA[What is Index Awareness?
The first topic that I covered in my &#8220;Tales From a Universe Ninja&#8221; presentation at the 2007 Insight Americas conference was Index Awareness. I have to admit, this would probably not have been my first choice for a topic. I covered it on request from a member of the Universe Designer product [...]]]></description>
			<content:encoded><![CDATA[<h3>What is Index Awareness?</h3>
<p>The first topic that I covered in my &#8220;Tales From a Universe Ninja&#8221; presentation at the 2007 Insight Americas conference was Index Awareness. I have to admit, this would probably not have been my first choice for a topic. I covered it on request from a member of the Universe Designer product team. As I went through this feature I found that much of what I remembered was still true even in XI R2. But I also found that in the right environment this feature could really help.</p>
<p>If you have downloaded a copy of my presentation then I am going to cover slides 10 through 16 in this blog post. Future blog posts will cover the rest of the material from the presentation. I believe that this feature was introduced in version 6.5 which means you must be at least at that version to be able to consider using it.</p>
<p>This feature is defined in the Universe Designer help file as follows:</p>
<blockquote><p>Object keys allow Universe Designer to generate more efficient SQL by filtering on primary key values and eliminating unnecessary joins.</p></blockquote>
<p>That&#8217;s great, but what does it mean?</p>
<p><span id="more-52"></span></p>
<h3>Setting Up Index Awareness</h3>
<p>When a designer builds an object there is a new tab available on the object properties screen called <strong>Keys</strong> as shown here:</p>
<p><img src="/presentations/2007/insight/images/0052_001_key_definition.jpg" /></p>
<p>This tab is where you can define the primary and foreign keys for the table in question. In this case, I am showing keys for the Country table from the Island Resorts Marketing universe. The table is referenced via an alias in order to break up a loop, and the keys are identified here:</p>
<p><img src="/presentations/2007/insight/images/0052_002_key_joins.jpg" /></p>
<p>If a table has foreign keys in more than one place that is not a problem. The designer can include as many key values as are appropriate. Here is another example from the Island Resorts universe, showing the Service table being related to two &#8220;fact&#8221; tables; one is for reservations and the other is for invoices.</p>
<p><img src="/presentations/2007/insight/images/0052_003_key_options.jpg" /></p>
<p>Once the keys are defined, what does it do?</p>
<h3>Index Awareness In Action</h3>
<p>One of the main drawbacks to this feature is that it does not always work. There are certain things that have to be done in order to reap the benefits. The easiest way to start is to say that in order to get the key benefits the report user has to pick from a list of values. If the user enters a value manually, it does not work. If the user respond to a prompt, it does not work. (More on the prompt thing in a later post.)</p>
<p>So here is a screen shot showing a user selecting the Resort name (which has been defined as Index Aware) on a query panel:</p>
<p><img src="/presentations/2007/insight/images/0052_004_picklist.jpg" /></p>
<p>And here is the SQL code generated by the query shown above:</p>
<p><code>SELECT<br />
  max( RESORT.resort  ),<br />
  sum(INVOICE_LINE.DAYS * INVOICE_LINE.NB_GUESTS * SERVICE.PRICE)<br />
FROM  RESORT,  INVOICE_LINE,  SERVICE,  SERVICE_LINE<br />
WHERE  ( RESORT.RESORT_ID=SERVICE_LINE.RESORT_ID  )<br />
  AND  ( SERVICE_LINE.SL_ID=SERVICE.SL_ID )<br />
  AND  ( SERVICE.SERVICE_ID=INVOICE_LINE.SERVICE_ID  )<br />
  AND    RESORT.RESORT_ID  =  2<br />
GROUP BY<br />
  RESORT.RESORT_ID</code></p>
<p>The important line is this one:</p>
<p><code>AND    RESORT.RESORT_ID  =  2</code></p>
<p>Without the index keys the condition would have been based off of the resort name instead of the resort key. And it gets even better. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
<p>If the Resort result object is removed from the query then the query panel would look like this:</p>
<p><img src="/presentations/2007/insight/images/0052_006_query_panel.jpg" /></p>
<p>And here is what the SQL code looks like:</p>
<p><code>SELECT<br />
  sum(INVOICE_LINE.DAYS * INVOICE_LINE.NB_GUESTS * SERVICE.PRICE)<br />
FROM  INVOICE_LINE,  SERVICE,  SERVICE_LINE<br />
WHERE  ( SERVICE_LINE.SL_ID=SERVICE.SL_ID  )<br />
  AND  ( SERVICE.SERVICE_ID=INVOICE_LINE.SERVICE_ID  )<br />
  AND    SERVICE_LINE.RESORT_ID  =  2</code></p>
<p>What has changed? Two very important things. First, the RESORT table has been removed from the query altogether. Second, the condition has switched to the foreign key defined in the SERVICE_LINE table instead. The query is much more efficient.</p>
<p>When I first read about this feature one of the touted features was a &#8220;Fact Only&#8221; query. That is certainly possible. I created a query that uses three conditions, all of them with Index Awareness defined, and the following SQL was generated:</p>
<p><code>SELECT<br />
  sum(SHOP_FACTS.Amount_sold)<br />
FROM<br />
  SHOP_FACTS<br />
WHERE<br />
  (SHOP_FACTS.WEEK_KEY  =  233<br />
   AND<br />
   SHOP_FACTS.ARTICLE_CODE  =  177264<br />
   AND<br />
   SHOP_FACTS.SHOP_CODE  =  203)</code></p>
<p>This is really efficient SQL! However, the results are not very interesting. Without the key values as results the fact table is the only table referenced in the SQL code. But without those key values as output, the resulting report is not very interesting. (Please see slide 16 for more details, if you are interested.)</p>
<h3>Summary</h3>
<p>In this post I defined what Index Awareness was, showed how to set it up, and showed how it can help create more efficient SQL. The next post will start to talk about some of the challenges that you might encounter when using this feature.</p>
<h3>Technical Notes</h3>
<p>The universes used in my presentation were based on Island Resorts Marketing and eFashion. Both databases were converted to Oracle 10g in order to use some of the more advanced features that do not work with Microsoft Access. These universes and databases are not available for download at this time but I plan to make them available at some point in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2007/10/26/index-awareness-part-i-the-basics/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

