<?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/"
	>
<channel>
	<title>Ramblings from the bit bucket &#187; ima</title>
	<atom:link href="http://blogs.planetingres.org/notnull/tag/ima/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.planetingres.org/notnull</link>
	<description>Just another blogs.planetingres.org weblog</description>
	<lastBuildDate>Tue, 01 Feb 2011 09:13:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Useful or useless? Follow on post &#8230;</title>
		<link>http://blogs.planetingres.org/notnull/2010/02/23/useful-or-useless-follow-on-post/</link>
		<comments>http://blogs.planetingres.org/notnull/2010/02/23/useful-or-useless-follow-on-post/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 08:48:36 +0000</pubDate>
		<dc:creator>notnull</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[ima]]></category>
		<category><![CDATA[ingres]]></category>
		<guid isPermaLink="false">http://blogs.planetingres.org/notnull/?p=131</guid>
		<description><![CDATA[Way back in May last year I experimented with some IMA tables that showed data types and operators defined in the DBMS.  Further poking around and a table for a list of the function instances is available, drop ima_dbms_fis; \p\g register table ima_dbms_fis ( server varchar(64) not null not default is 'SERVER', id integer4 not [...]]]></description>
			<content:encoded><![CDATA[<p>Way back in May last year I experimented with some IMA tables that<a title="Useful or useless? You decide" href="http://blogs.planetingres.org/notnull/2009/05/01/useful-or-useless-you-decide/"> showed data types and operators</a> defined in the DBMS.  Further poking around and a table for a list of the function instances is available,</p>
<pre>drop ima_dbms_fis;
\p\g
register table ima_dbms_fis (
        server varchar(64) not null not default is
                'SERVER',
        id integer4 not null not default is
                'exp.adf.adg.fi_id',
        complement integer4 not null not default is
                'exp.adf.adg.fi_cmplmnt',
        type varchar(20) not null not default is
                'exp.adf.adg.fi_type',
        flags integer4 not null not default is
                'exp.adf.adg.fi_flags',
        opid integer4 not null not default is
                'exp.adf.adg.fi_opid',
        args integer4 not null not default is
                'exp.adf.adg.fi_numargs',
        dtresult integer4 not null not default is
                'exp.adf.adg.fi_dtresult',
        dtarg1 integer4 not null not default is
                'exp.adf.adg.fi_dtarg1',
        dtarg2 integer4 not null not default is
                'exp.adf.adg.fi_dtarg2',
        dtarg3 integer4 not null not default is
                'exp.adf.adg.fi_dtarg3',
        dtarg4 integer4 not null not default is
                'exp.adf.adg.fi_dtarg4'
)
as import from 'tables'
with dbms = IMA,
structure = sortkeyed,
key = (server);
\p\g
grant all on ima_dbms_fis to ingres;
\p\g
grant select on ima_dbms_fis to public;
\p\g</pre>
<p>Adding this table to ima_dbms_types and ima_dbms_operators adds the ability to retrieve the list of functions and their signatures.  The query makes use of an internal function <em>iitypename</em> which translates the numeric type code into a name.</p>
<pre>select
    a.name,
    case when a.type='COMPARISON' then
        trim(iitypename(b.dtresult)) + ' = ( ' +
        trim(iitypename(b.dtarg1)) + ' ' +
        a.name + ' ' +
        trim(iitypename(b.dtarg2)) + ' )'
        when a.type='OPERATOR' then
        trim(iitypename(b.dtresult)) + ' = ( ' +
        trim(iitypename(b.dtarg1)) + ' ' +
        a.name + ' ' +
        trim(iitypename(b.dtarg2)) + ' )'
    else
        trim(iitypename(b.dtresult)) + ' = ' +
        a.name + '( ' +
            case when b.dtarg1 != '' then trim(iitypename(b.dtarg1)) else '' end +
            case when b.dtarg2 != '' then ', ' + trim(iitypename(b.dtarg2)) else '' end +
            case when b.dtarg3 != '' then ', ' + trim(iitypename(b.dtarg3)) else '' end +
            case when b.dtarg4 != '' then ', ' + trim(iitypename(b.dtarg4)) else '' end
        + ' )'
    end as signature
from
    ima_dbms_operators a,
    ima_dbms_fis b
where
    a.opid = b.opid
group by a.name, 2
order by a.name</pre>
<p>Some sample output from this query:</p>
<pre>|name                          |signature                       |
|soundex                       |char = soundex( text )          |
|soundex                       |char = soundex( varchar )       |
|sqrt                          |float = sqrt( float )           |
|squeeze                       |nvarchar = squeeze( nchar )     |
|squeeze                       |nvarchar = squeeze( nvarchar )  |
|squeeze                       |text = squeeze( c )             |</pre>
<p>So in answer to my own question; yes, it is useful.  I&#8217;ll be trying this on an <a title="IngresGeospatial" href="http://community.ingres.com/wiki/IngresGeospatial">IngresGeospatial</a> build when I get my hands on one.<br />
<h3>Related posts</h3>
<ul class="related_post">
<li><a href="http://blogs.planetingres.org/notnull/2010/05/16/debugging-the-hibernate-project-with-eclipse/" title="Debugging the Hibernate project with Eclipse">Debugging the Hibernate project with Eclipse</a></li>
<li><a href="http://blogs.planetingres.org/notnull/2010/04/01/hibernate-3-5-0-final-released/" title="Hibernate 3.5.0-Final released">Hibernate 3.5.0-Final released</a></li>
<li><a href="http://blogs.planetingres.org/notnull/2008/03/28/google-summer-of-code-gsoc-2008/" title="Google Summer of Code (GSoC) 2008">Google Summer of Code (GSoC) 2008</a></li>
<li><a href="http://blogs.planetingres.org/notnull/2006/06/08/ima-guru-pronounced-im-a-guru-i-definitely-am-not/" title="IMA Guru (Pronounced, I&#8217;m A Guru) &#8211; I definitely am not">IMA Guru (Pronounced, I&#8217;m A Guru) &#8211; I definitely am not</a></li>
<li><a href="http://blogs.planetingres.org/notnull/2011/02/01/data-access-message-protocol-wireshark-dissector/" title="Data Access Message Protocol &#8211; Wireshark dissector">Data Access Message Protocol &#8211; Wireshark dissector</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blogs.planetingres.org/notnull/2010/02/23/useful-or-useless-follow-on-post/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Useful or useless? You decide.</title>
		<link>http://blogs.planetingres.org/notnull/2009/05/01/useful-or-useless-you-decide/</link>
		<comments>http://blogs.planetingres.org/notnull/2009/05/01/useful-or-useless-you-decide/#comments</comments>
		<pubDate>Fri, 01 May 2009 17:29:44 +0000</pubDate>
		<dc:creator>notnull</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[ima]]></category>
		<category><![CDATA[ADF]]></category>
		<guid isPermaLink="false">http://blogs.planetingres.org/notnull/?p=79</guid>
		<description><![CDATA[I&#8217;ve been poking around the ADF code and came across these IMA objects for data types and operators in the DBMS. These IMA objects, like many others, exist but are never exposed. Data types The following registration will create a table that contains data type name and the data type description bits. drop ima_dbms_datatypes; \p\g [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been poking around the ADF code and came across these IMA objects for data types and operators in the DBMS.<br />
These IMA objects, like many others, exist but are never exposed.</p>
<p><strong>Data types</strong><br />
The following registration will create a table that contains data type name and the data type description bits.<br />
<code>
<pre>drop ima_dbms_datatypes;
\p\g
register table ima_dbms_datatypes (
	server varchar(64) not null not default is
		'SERVER',
	name varchar(30) not null not default is
		'exp.adf.adg.dt_name',
	id integer4 not null not default is
		'exp.adf.adg.dt_id',
	stat integer4 not null not default is
		'exp.adf.adg.dt_stat'
)
as import from 'tables'
with dbms = IMA,
structure = sortkeyed,
key = (server);
\p\g
grant all on ima_dbms_datatypes to ingres with grant option;
\p\g
grant select on ima_dbms_datatypes to public;
\p\g</pre>
<p></code></p>
<p>The data type description bits should match the definitions in <a href="http://lxr.ingres.com/lxr/source/src/common/hdr/hdr/adf.h">adf.h</a>.  Use the hex function in the select to make the values easier to read.<br />
<code>select id, hex(stat) as stat, name from ima_dbms_datatypes;</code></p>
<p><strong>Operators</strong><br />
The following registration will create a table containing information about the operators available in the DBMS.<br />
<code>
<pre>drop ima_dbms_operators;
\p\g
register table ima_dbms_operators (
	server varchar(64) not null not default is
		'SERVER',
	name varchar(30) not null not default is
		'exp.adf.adg.op_name',
	opid integer4 not null not default is /* order within the constructed operator list */
		'exp.adf.adg.op_id',
	type varchar(20) not null not default is /* type of operator */
		'exp.adf.adg.op_type',
        use varchar(30) not null not default is /* where in an expression the operator is used */
                'exp.adf.adg.op_use',
        qlang integer not null not default is /* the query language where the operator is permitted 1=QUEL, 2=SQL*/
                'exp.adf.adg.op_qlangs',
        cntfi integer not null not default is /* count of function instances */
                'exp.adf.adg.op_cntfi'
)
as import from 'tables'
with dbms = IMA,
structure = sortkeyed,
key = (server);
\p\g
grant all on ima_dbms_operators to ingres with grant option;
\p\g
grant select on ima_dbms_operators to public;
\p\g</pre>
<p></code><br />
A query of the table produces an indiscriminate list of functions defined in the DBMS.</p>
<p>I&#8217;ve only tried to register these tables on Ingres II 9.2.0 and if you are considering trying them out the usual disclaimers apply.</p>
<p>So, useful or useless?<br />
<h3>Related posts</h3>
<ul class="related_post">
<li><a href="http://blogs.planetingres.org/notnull/2010/02/23/useful-or-useless-follow-on-post/" title="Useful or useless? Follow on post &#8230;">Useful or useless? Follow on post &#8230;</a></li>
<li><a href="http://blogs.planetingres.org/notnull/2006/06/08/ima-guru-pronounced-im-a-guru-i-definitely-am-not/" title="IMA Guru (Pronounced, I&#8217;m A Guru) &#8211; I definitely am not">IMA Guru (Pronounced, I&#8217;m A Guru) &#8211; I definitely am not</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blogs.planetingres.org/notnull/2009/05/01/useful-or-useless-you-decide/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IMA Guru (Pronounced, I&#8217;m A Guru) &#8211; I definitely am not</title>
		<link>http://blogs.planetingres.org/notnull/2006/06/08/ima-guru-pronounced-im-a-guru-i-definitely-am-not/</link>
		<comments>http://blogs.planetingres.org/notnull/2006/06/08/ima-guru-pronounced-im-a-guru-i-definitely-am-not/#comments</comments>
		<pubDate>Thu, 08 Jun 2006 14:00:38 +0000</pubDate>
		<dc:creator>notnull</dc:creator>
				<category><![CDATA[ingres]]></category>
		<category><![CDATA[ima]]></category>
		<category><![CDATA[management]]></category>
		<guid isPermaLink="false">http://blogs.planetingres.org/notnull/2006/06/08/ima-guru-pronounced-im-a-guru-i-definitely-am-not/</guid>
		<description><![CDATA[This has been a long running pun within Ingres development. The Ingres Management Architecture (IMA) is an intrinsic part of the processes that compose the Ingres DBMS, yet no one claims responsibility for it. For the uninitiated, IMA is a powerful mechanism where the values from elements of a programming structure within an Ingres process [...]]]></description>
			<content:encoded><![CDATA[<p>This has been a long running pun within Ingres development. The Ingres Management Architecture (IMA) is an intrinsic part of the processes that compose the Ingres DBMS, yet no one claims responsibility for it.<br />
<span id="more-17"></span><br />
For the uninitiated, IMA is a powerful mechanism where the values from elements of a programming structure within an Ingres process can be exposed as attributes in a table, giving a direct snapshot of Ingres. This makes customizing applications for monitoring and maintenance easier, for example, Visual DBA uses this mechanism to obtain its information.</p>
<p>The weakness of IMA is the lack of documentation and the reason? There are over 1700 parameters, maybe more, that cover many aspects of the internal control structures. The meaning of each of the values and their inter-relationship is usually locked within the mind of the person who decided to exposed it. The strength of IMA is the ability to extract these values as queries into the DBMS. This means that DBMS values can be exposed via any client technology that can issue queries.</p>
<p>There have been a few attempts to start the documentation of each parameter yet the projects have been stifled by the sheer volume of information and knowledge that is required.</p>
<p>Some attempts have been made to define a standard schema with the assistance of thrid party vendors and partners whilst maintaining some degree of client confidentiality. Inevitably, with each new version of Ingres some subtle change in the control structure reduces one or more of these monitoring queries to return zero rows.</p>
<p>I shall leave the vagaries of registering IMA tables for someone else or to a later post (much later).</p>
<p>For the inquisitive, this sample query returns a list of the sessions that are using an Ingres lock, those that are waiting and the one that is granted together with the query text. I&#8217;ve only tried it on Ingres 2006. Hope you find it useful, usual disclaimers apply.<br />
<code>select<br />
a.server, a.session_id, db_name, _bintim() - session_time as duration,<br />
session_cpu as cpu, session_query, session_lquery, resource_id, lock_state from<br />
ima_server_sessions a, ima_server_sessions_extra b,<br />
ima_server_sessions_desc e, ima_locklists c, ima_locks d, ima_server_sessions_query q<br />
where<br />
a.session_id = q.session_id and<br />
resource_id in<br />
(select<br />
b.resource_id<br />
from<br />
ima_locklists a, ima_locks b<br />
where<br />
a.locklist_wait_id = b.lock_id)<br />
and c.locklist_id = d.locklist_id<br />
and a.session_id = c.locklist_session_id<br />
and a.session_id = b.session_id<br />
and a.session_id = e.session_id \p\g<br />
</code><br />
In order to see the last query a table is added to include a field that is included in Ingres but is not yet exposed. The session_lquery field provides the text of the previously executed query for the session.<br />
<code>/*<br />
** Add ima_server_sessions_query table.<br />
**<br />
** This script should be run as $ingres.<br />
** e.g.<br />
**      sql -u"\$ingres" imadb<br />
**<br />
** Add session_lquery.  For imadb created with 4k pages the field could<br />
** fit in the ima_server_sessions table.<br />
*/<br />
drop table ima_server_sessions_query;<br />
\p\g<br />
register table ima_server_sessions_query(<br />
server varchar(64) not null not default is<br />
'SERVER',<br />
session_id varchar(32) not null not default is<br />
'exp.scf.scs.scb_index',<br />
session_lquery varchar(1000) not null not default is<br />
'exp.scf.scs.scb_lastquery' )<br />
as import from 'tables' with dbms = IMA,<br />
structure = unique sortkeyed,<br />
key = (server, session_id)<br />
\p\g<br />
grant select on ima_server_sessions_query to public with grant option;<br />
\p\g<br />
</code><br />
<h3>Related posts</h3>
<ul class="related_post">
<li><a href="http://blogs.planetingres.org/notnull/2010/02/23/useful-or-useless-follow-on-post/" title="Useful or useless? Follow on post &#8230;">Useful or useless? Follow on post &#8230;</a></li>
<li><a href="http://blogs.planetingres.org/notnull/2011/02/01/data-access-message-protocol-wireshark-dissector/" title="Data Access Message Protocol &#8211; Wireshark dissector">Data Access Message Protocol &#8211; Wireshark dissector</a></li>
<li><a href="http://blogs.planetingres.org/notnull/2011/02/01/ingres-migration-toolset/" title="Ingres Migration Toolset">Ingres Migration Toolset</a></li>
<li><a href="http://blogs.planetingres.org/notnull/2010/08/11/ingres-command-line-rpm-installation/" title="Ingres command line RPM installation">Ingres command line RPM installation</a></li>
<li><a href="http://blogs.planetingres.org/notnull/2010/08/09/ingres-doc-search-plug-in-updated/" title="Ingres doc search plug-in updated">Ingres doc search plug-in updated</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blogs.planetingres.org/notnull/2006/06/08/ima-guru-pronounced-im-a-guru-i-definitely-am-not/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

