blob: 8e36b283c918b01f117947bcc370a5f29252ac46 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MADlib: Profile</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<script src="../mathjax/MathJax.js">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">MADlib
&#160;<span id="projectnumber">0.7</span> <span style="font-size:10pt; font-style:italic"><a href="../latest/./group__grp__profile.html"> A newer version is available</a></span>
</div>
<div id="projectbrief">User Documentation</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="dynsections.js"></script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
initNavTree('group__grp__profile.html','');
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">Profile</div> </div>
<div class="ingroups"><a class="el" href="group__grp__desc__stats.html">Descriptive Statistics</a></div></div>
<div class="contents">
<div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
<img id="dynsection-0-trigger" src="closed.png" alt="+"/> Collaboration diagram for Profile:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
<center><table><tr><td><div class="center"><iframe scrolling="no" frameborder="0" src="group__grp__profile.svg" width="275" height="40"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</td></tr></table></center>
</div>
<dl class="user"><dt><b>About:</b></dt><dd>This module computes a "profile" of a table or view: a predefined set of aggregates to be run on each column of a table.</dd></dl>
<p>The following aggregates will be called on every integer column:</p>
<ul>
<li>min(), max(), <a class="el" href="linalg_8sql__in.html#a1aa37f73fb1cd8d7d106aa518dd8c0b4" title="Compute the average of vectors.">avg()</a></li>
<li>madlib.cmsketch_median()</li>
<li>madlib.cmsketch_depth_histogram()</li>
<li>madlib.cmsketch_width_histogram()</li>
</ul>
<p>And these on non-integer columns:</p>
<ul>
<li>madlib.fmsketch_dcount()</li>
<li>madlib.mfvsketch_quick_histogram()</li>
<li>madlib.mfvsketch_top_histogram()</li>
</ul>
<p>Because the input schema of the table or view is unknown, we need to synthesize SQL to suit. This is done either via the <code>profile</code> or <code>profile_full</code> user defined function.</p>
<dl class="user"><dt><b>Usage:</b></dt><dd></dd></dl>
<ul>
<li>Generate a basic profile information (subset of predefined aggregate functions) for all columns of the input table. <pre>SELECT * FROM <a class="el" href="profile_8sql__in.html#a22f0136bb3d7740262b13030a2925a80">profile</a>( '<em>input_table</em>');</pre></li>
<li>Generate a full profile information (all predefined aggregate functions) for all columns of the input table. <pre>SELECT * FROM <a class="el" href="profile_8sql__in.html#a879e445d74412b093d411ed9a7180a1e">profile_full</a>( '<em>input_table</em>', <em>buckets</em>);</pre></li>
</ul>
<dl class="user"><dt><b>Examples:</b></dt><dd></dd></dl>
<ul>
<li>For basic profile run: <div class="fragment"><pre class="fragment">
sql&gt; SELECT * FROM profile( 'pg_catalog.pg_tables');
schema_name | table_name | column_name | function | value
-------------+------------+-------------+-------------------+-------
pg_catalog | pg_tables | * | COUNT() | 105
pg_catalog | pg_tables | schemaname | fmsketch_dcount() | 6
pg_catalog | pg_tables | tablename | fmsketch_dcount() | 104
pg_catalog | pg_tables | tableowner | fmsketch_dcount() | 2
pg_catalog | pg_tables | tablespace | fmsketch_dcount() | 1
pg_catalog | pg_tables | hasindexes | fmsketch_dcount() | 2
pg_catalog | pg_tables | hasrules | fmsketch_dcount() | 1
pg_catalog | pg_tables | hastriggers | fmsketch_dcount() | 2
(8 rows)
</pre></div></li>
</ul>
<ul>
<li>For full profile run: <div class="fragment"><pre class="fragment">
sql&gt; SELECT * FROM profile_full( 'pg_catalog.pg_tables', 5);
schema_name | table_name | column_name | function | value
-------------+------------+-------------+-------------------------------------------------+----------------------------------------------------------------------------------------------------
pg_catalog | pg_tables | * | COUNT() | 105
pg_catalog | pg_tables | schemaname | fmsketch_dcount() | 6
pg_catalog | pg_tables | schemaname | array_collapse(mfvsketch_quick_histogram((),5)) | [0:4]={pg_catalog:68,public:19,information_schema:7,gp_toolkit:5,maddy:5}
pg_catalog | pg_tables | schemaname | array_collapse(mfvsketch_top_histogram((),5)) | [0:4]={pg_catalog:68,public:19,information_schema:7,gp_toolkit:5,maddy:5}
pg_catalog | pg_tables | tablename | fmsketch_dcount() | 104
pg_catalog | pg_tables | tablename | array_collapse(mfvsketch_quick_histogram((),5)) | [0:4]={migrationhistory:2,pg_statistic:1,sql_features:1,sql_implementation_info:1,sql_languages:1}
pg_catalog | pg_tables | tablename | array_collapse(mfvsketch_top_histogram((),5)) | [0:4]={migrationhistory:2,pg_statistic:1,sql_features:1,sql_implementation_info:1,sql_languages:1}
pg_catalog | pg_tables | tableowner | fmsketch_dcount() | 2
pg_catalog | pg_tables | tableowner | array_collapse(mfvsketch_quick_histogram((),5)) | [0:1]={agorajek:104,alex:1}
pg_catalog | pg_tables | tableowner | array_collapse(mfvsketch_top_histogram((),5)) | [0:1]={agorajek:104,alex:1}
pg_catalog | pg_tables | tablespace | fmsketch_dcount() | 1
pg_catalog | pg_tables | tablespace | array_collapse(mfvsketch_quick_histogram((),5)) | [0:0]={pg_global:28}
pg_catalog | pg_tables | tablespace | array_collapse(mfvsketch_top_histogram((),5)) | [0:0]={pg_global:28}
pg_catalog | pg_tables | hasindexes | fmsketch_dcount() | 2
pg_catalog | pg_tables | hasindexes | array_collapse(mfvsketch_quick_histogram((),5)) | [0:1]={t:59,f:46}
pg_catalog | pg_tables | hasindexes | array_collapse(mfvsketch_top_histogram((),5)) | [0:1]={t:59,f:46}
pg_catalog | pg_tables | hasrules | fmsketch_dcount() | 1
pg_catalog | pg_tables | hasrules | array_collapse(mfvsketch_quick_histogram((),5)) | [0:0]={f:105}
pg_catalog | pg_tables | hasrules | array_collapse(mfvsketch_top_histogram((),5)) | [0:0]={f:105}
pg_catalog | pg_tables | hastriggers | fmsketch_dcount() | 2
pg_catalog | pg_tables | hastriggers | array_collapse(mfvsketch_quick_histogram((),5)) | [0:1]={f:102,t:3}
pg_catalog | pg_tables | hastriggers | array_collapse(mfvsketch_top_histogram((),5)) | [0:1]={f:102,t:3}
(22 rows)
</pre></div></li>
</ul>
<dl class="user"><dt><b>Implementation Notes:</b></dt><dd></dd></dl>
<p>Because some of the aggregate functions used in profile return multi-dimensional arrays, which are not easily handled in pl/python, we are using <code>array_collapse</code> function to collaps the n-dim arrays to 1-dim arrays. All values of 2 and upper dimensions are separated with ':' character.</p>
<dl class="see"><dt><b>See also:</b></dt><dd>File <a class="el" href="profile_8sql__in.html" title="SQL function for single-pass table profiles.">profile.sql_in</a> documenting SQL functions. </dd></dl>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<li class="footer">Generated on Fri May 10 2013 01:37:13 for MADlib by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
</ul>
</div>
</body>
</html>