<?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>phacai.com</title>
	<atom:link href="http://www.phacai.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.phacai.com</link>
	<description>Gigabyte, Terabyte, Petabyte</description>
	<lastBuildDate>Tue, 07 Feb 2012 20:25:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Indexes created by dbt3 (TPC-H)</title>
		<link>http://www.phacai.com/indexes-created-by-dbt3-tpc-h</link>
		<comments>http://www.phacai.com/indexes-created-by-dbt3-tpc-h#comments</comments>
		<pubDate>Tue, 07 Feb 2012 20:25:18 +0000</pubDate>
		<dc:creator>Mr. One</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.phacai.com/?p=1295</guid>
		<description><![CDATA[DBT3 creates many indexes: one primary index on the primary key of each table, and the following secondary indexes: CREATE INDEX i_l_shipdate ON lineitem (l_shipdate); CREATE INDEX i_l_suppkey_partkey ON lineitem (l_partkey, l_suppkey); CREATE INDEX i_l_partkey ON lineitem (l_partkey); CREATE INDEX i_l_suppkey ON lineitem (l_suppkey); CREATE INDEX i_l_receiptdate ON lineitem (l_receiptdate); CREATE INDEX i_l_orderkey ON lineitem [...]


Related posts:<ol><li><a href='http://www.phacai.com/error-in-rf2-of-dbt3-tpc-h' rel='bookmark' title='Permanent Link: Error in rf2 of DBT3 (TPC-H)'>Error in rf2 of DBT3 (TPC-H)</a></li>
<li><a href='http://www.phacai.com/preparations-to-use-tpch-data-on-postgresql' rel='bookmark' title='Permanent Link: Preparations to use TPCH data on Postgresql'>Preparations to use TPCH data on Postgresql</a></li>
<li><a href='http://www.phacai.com/postgresql-how-an-index-is-physically-created-on-disk' rel='bookmark' title='Permanent Link: Postgresql: how an index is physically created on disk'>Postgresql: how an index is physically created on disk</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>DBT3 creates many indexes: one primary index on the primary key of each table, and the following secondary indexes:<br />
<span id="more-1295"></span></p>
<pre>
CREATE INDEX i_l_shipdate ON lineitem (l_shipdate);
CREATE INDEX i_l_suppkey_partkey ON lineitem (l_partkey, l_suppkey);
CREATE INDEX i_l_partkey ON lineitem (l_partkey);
CREATE INDEX i_l_suppkey ON lineitem (l_suppkey);
CREATE INDEX i_l_receiptdate ON lineitem (l_receiptdate);
CREATE INDEX i_l_orderkey ON lineitem (l_orderkey);
CREATE INDEX i_l_orderkey_quantity ON lineitem (l_orderkey, l_quantity);
CREATE INDEX i_c_nationkey ON customer (c_nationkey);
CREATE INDEX i_o_orderdate ON orders (o_orderdate);
CREATE INDEX i_o_custkey ON orders (o_custkey);
CREATE INDEX i_s_nationkey ON supplier (s_nationkey);
CREATE INDEX i_ps_partkey ON partsupp (ps_partkey);
CREATE INDEX i_ps_suppkey ON partsupp (ps_suppkey);
CREATE INDEX i_n_regionkey ON nation (n_regionkey);
CREATE INDEX i_l_commitdate ON lineitem (l_commitdate);
</pre>
<p>However, not every index will be used. Generating more than necessary indexes will increase the data set size. I analyzed in my settings, only 14 indexes are used (4 primary and 10 secondary):</p>
<pre>
i_l_orderkey
i_l_partkey
i_l_receiptdate
i_l_shipdate
i_l_suppkey_partkey
i_o_custkey
i_o_orderdate
i_ps_partkey
i_ps_suppkey
i_s_nationkey
pk_customer
pk_orders
pk_part
pk_supplier
</pre>
<p>We can modify &#8220;dbts/scripts/pgsql/create_indexes.sh&#8221; to reduce the number of indexes, thus reducing dataset size.</p>


<p>Related posts:<ol><li><a href='http://www.phacai.com/error-in-rf2-of-dbt3-tpc-h' rel='bookmark' title='Permanent Link: Error in rf2 of DBT3 (TPC-H)'>Error in rf2 of DBT3 (TPC-H)</a></li>
<li><a href='http://www.phacai.com/preparations-to-use-tpch-data-on-postgresql' rel='bookmark' title='Permanent Link: Preparations to use TPCH data on Postgresql'>Preparations to use TPCH data on Postgresql</a></li>
<li><a href='http://www.phacai.com/postgresql-how-an-index-is-physically-created-on-disk' rel='bookmark' title='Permanent Link: Postgresql: how an index is physically created on disk'>Postgresql: how an index is physically created on disk</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.phacai.com/indexes-created-by-dbt3-tpc-h/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error in rf2 of DBT3 (TPC-H)</title>
		<link>http://www.phacai.com/error-in-rf2-of-dbt3-tpc-h</link>
		<comments>http://www.phacai.com/error-in-rf2-of-dbt3-tpc-h#comments</comments>
		<pubDate>Fri, 03 Feb 2012 16:01:27 +0000</pubDate>
		<dc:creator>Mr. One</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.phacai.com/?p=1293</guid>
		<description><![CDATA[First of all, I am using PostgreSQL. The error message looks like this: ERROR: missing FROM-clause entry for table "tmp_orderkey1" LINE 1: delete from lineitem where l_orderkey=tmp_orderkey1.orderkey... ERROR: missing FROM-clause entry for table "tmp_orderkey1" LINE 1: delete from orders where o_orderkey=tmp_orderkey1.orderkey... The meaning of the error message is that we must explicitly specify that we [...]


Related posts:<ol><li><a href='http://www.phacai.com/indexes-created-by-dbt3-tpc-h' rel='bookmark' title='Permanent Link: Indexes created by dbt3 (TPC-H)'>Indexes created by dbt3 (TPC-H)</a></li>
<li><a href='http://www.phacai.com/error-%e2%80%98textout%e2%80%99-undeclared-first-use-in-this-function' rel='bookmark' title='Permanent Link: error: ‘textout’ undeclared (first use in this function)'>error: ‘textout’ undeclared (first use in this function)</a></li>
<li><a href='http://www.phacai.com/error-when-running-dbt2-cant-locate-testparserdbt2-pm-in-inc' rel='bookmark' title='Permanent Link: Error when running DBT2: &#8220;Can&#8217;t locate Test/Parser/Dbt2.pm in @INC&#8221;'>Error when running DBT2: &#8220;Can&#8217;t locate Test/Parser/Dbt2.pm in @INC&#8221;</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>First of all, I am using PostgreSQL. The error message looks like this:</p>
<pre>
ERROR:  missing FROM-clause entry for table "tmp_orderkey1"
LINE 1: delete from lineitem where l_orderkey=tmp_orderkey1.orderkey...

ERROR:  missing FROM-clause entry for table "tmp_orderkey1"
LINE 1: delete from orders where o_orderkey=tmp_orderkey1.orderkey...
</pre>
<p><span id="more-1293"></span><br />
The meaning of the error message is that we must explicitly specify that we want to retrieve values stored in table &#8220;tmp_orderkey1&#8243;. This happens in TPC-H Refresh Function 2 (rf2). This function deletes records from some tables.</p>
<p>Let&#8217;s first review the DELETE in PostgreSQL: <a href="http://www.postgresql.org/docs/8.1/static/sql-delete.html">link</a>.</p>
<p>Now let&#8217;s check out file &#8220;dbt3/scripts/pgsql/run_rf2.sh&#8221;. Towards the bottom of this file, we could see two lines of SQL commands &#8220;delete from &#8230;&#8221;. One modifies &#8220;lineitem&#8221; and the other modifies &#8220;orders&#8221;. Before the &#8220;where&#8221; of these two commands, add &#8220;using tmp_orderkey$set_num&#8221;. This will fix the problem.</p>


<p>Related posts:<ol><li><a href='http://www.phacai.com/indexes-created-by-dbt3-tpc-h' rel='bookmark' title='Permanent Link: Indexes created by dbt3 (TPC-H)'>Indexes created by dbt3 (TPC-H)</a></li>
<li><a href='http://www.phacai.com/error-%e2%80%98textout%e2%80%99-undeclared-first-use-in-this-function' rel='bookmark' title='Permanent Link: error: ‘textout’ undeclared (first use in this function)'>error: ‘textout’ undeclared (first use in this function)</a></li>
<li><a href='http://www.phacai.com/error-when-running-dbt2-cant-locate-testparserdbt2-pm-in-inc' rel='bookmark' title='Permanent Link: Error when running DBT2: &#8220;Can&#8217;t locate Test/Parser/Dbt2.pm in @INC&#8221;'>Error when running DBT2: &#8220;Can&#8217;t locate Test/Parser/Dbt2.pm in @INC&#8221;</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.phacai.com/error-in-rf2-of-dbt3-tpc-h/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A bug in DBT3 (TPC-H)</title>
		<link>http://www.phacai.com/a-bug-in-dbt3-tpc-h</link>
		<comments>http://www.phacai.com/a-bug-in-dbt3-tpc-h#comments</comments>
		<pubDate>Fri, 03 Feb 2012 02:42:52 +0000</pubDate>
		<dc:creator>Mr. One</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.phacai.com/?p=1289</guid>
		<description><![CDATA[First of all, this bug may not occur in every environment. I suspect that it has something to do the implementation of C library on your machine, specifically, the implementation of function &#8220;strcpy&#8221;. The result of this bug is that a syntactically wrong query might be generated. Look into file &#8220;dbt3/src/get_statement.c&#8221;. At the bottom, there [...]


Related posts:<ol><li><a href='http://www.phacai.com/error-in-rf2-of-dbt3-tpc-h' rel='bookmark' title='Permanent Link: Error in rf2 of DBT3 (TPC-H)'>Error in rf2 of DBT3 (TPC-H)</a></li>
<li><a href='http://www.phacai.com/code-to-compute-sha-1-hash-for-a-file' rel='bookmark' title='Permanent Link: Code to compute SHA-1 hash for a file'>Code to compute SHA-1 hash for a file</a></li>
<li><a href='http://www.phacai.com/how-to-implement-file-upload-with-cgic' rel='bookmark' title='Permanent Link: How to implement file upload with CGIC'>How to implement file upload with CGIC</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>First of all, this bug may not occur in every environment. I suspect that it has something to do the implementation of C library on your machine, specifically, the implementation of function &#8220;strcpy&#8221;.<br />
<span id="more-1289"></span><br />
The result of this bug is that a syntactically wrong query might be generated.</p>
<p>Look into file &#8220;dbt3/src/get_statement.c&#8221;. At the bottom, there is a function</p>
<div class="hl-surround">
<ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)">
<li class="hl-firstline"><span class="hl-types">void</span><span style="color: Gray;"> </span><span style="color: Blue;">ltrim</span><span style="color: Olive;">(</span><span class="hl-types">char</span><span style="color: Gray;"> *</span><span style="color: Blue;">str</span><span style="color: Olive;">)</span></li>
<li><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span class="hl-types">char</span><span style="color: Gray;"> *</span><span style="color: Blue;">start_pos</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">start_pos</span><span style="color: Gray;">=</span><span style="color: Blue;">str</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Green;">while</span><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">(</span><span style="color: Gray;">*</span><span style="color: Blue;">start_pos</span><span style="color: Gray;"> == &#8216; &#8216; || *</span><span style="color: Blue;">start_pos</span><span style="color: Gray;"> == &#8216;\</span><span style="color: Blue;">t</span><span style="color: Gray;">&#8216;</span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Blue;">start_pos</span><span style="color: Gray;">++;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">strcpy</span><span style="color: Olive;">(</span><span style="color: Blue;">str</span><span style="color: Gray;">, </span><span style="color: Blue;">start_pos</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Olive;">}</span></li>
</ol>
</div>
<p>Obviously, this function is supposed to trim the leading white spaces of each line. However, sometime (not always!) I get results like this:</p>
<pre>
before:  interval '1 month';
after:   interval '1 month;;
</pre>
<p>Something happened inside &#8220;strcpy&#8221;. To solve this problem, define another buffer, and replace the above Line 7 into the following Line 3 and 4:</p>
<div class="hl-surround">
<ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)">
<li class="hl-firstline"><span class="hl-types">char</span><span style="color: Gray;"> </span><span style="color: Blue;">buffer</span><span style="color: Olive;">[</span><span style="color: Maroon;">128</span><span style="color: Olive;">]</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&#8230;.</span></li>
<li><span style="color: Blue;">strcpy</span><span style="color: Olive;">(</span><span style="color: Blue;">buffer</span><span style="color: Gray;">, </span><span style="color: Blue;">start_ops</span><span style="color: Olive;">)</span><span style="color: Gray;">; </span></li>
<li><span style="color: Blue;">strcpy</span><span style="color: Olive;">(</span><span style="color: Blue;">str</span><span style="color: Gray;">, </span><span style="color: Blue;">buffer</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
</ol>
</div>
<p>Now the code works as expected.</p>


<p>Related posts:<ol><li><a href='http://www.phacai.com/error-in-rf2-of-dbt3-tpc-h' rel='bookmark' title='Permanent Link: Error in rf2 of DBT3 (TPC-H)'>Error in rf2 of DBT3 (TPC-H)</a></li>
<li><a href='http://www.phacai.com/code-to-compute-sha-1-hash-for-a-file' rel='bookmark' title='Permanent Link: Code to compute SHA-1 hash for a file'>Code to compute SHA-1 hash for a file</a></li>
<li><a href='http://www.phacai.com/how-to-implement-file-upload-with-cgic' rel='bookmark' title='Permanent Link: How to implement file upload with CGIC'>How to implement file upload with CGIC</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.phacai.com/a-bug-in-dbt3-tpc-h/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Write a kernel module that its parameters can be dynamically changed</title>
		<link>http://www.phacai.com/write-a-kernel-module-that-its-parameters-can-be-dynamically-changed</link>
		<comments>http://www.phacai.com/write-a-kernel-module-that-its-parameters-can-be-dynamically-changed#comments</comments>
		<pubDate>Thu, 02 Feb 2012 19:39:05 +0000</pubDate>
		<dc:creator>Mr. One</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.phacai.com/?p=1281</guid>
		<description><![CDATA[We know that every Linux kernel module can accept parameters from command line when it is first loaded, but sometimes we want to change the behavior of a module on the fly, without requiring the module to be removed and inserted again. To achieve this flexibility, we take advantage of the sysfs. For example, we [...]


Related posts:<ol><li><a href='http://www.phacai.com/trouble-shooting-for-writing-your-first-linux-module-on-ubuntu' rel='bookmark' title='Permanent Link: Trouble shooting for writing your first Linux module on Ubuntu'>Trouble shooting for writing your first Linux module on Ubuntu</a></li>
<li><a href='http://www.phacai.com/write-to-a-file-in-php' rel='bookmark' title='Permanent Link: Write to a file in PHP'>Write to a file in PHP</a></li>
<li><a href='http://www.phacai.com/location-of-the-kernel-symbol-table-on-fedora-linux' rel='bookmark' title='Permanent Link: Location of the kernel symbol table on Fedora Linux'>Location of the kernel symbol table on Fedora Linux</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>We know that every Linux kernel module can accept parameters from command line when it is first loaded, but sometimes we want to change the behavior of a module on the fly, without requiring the module to be removed and inserted again. To achieve this flexibility, we take advantage of the sysfs.<br />
<span id="more-1281"></span><br />
For example, we want to export such a parameter:</p>
<pre>
int mode=1;
module_param(mode, int, 444);
</pre>
<p>System call module_param creates an file in the sysfs. The pathname might be: /sys/module/modname/parameters/mode. Here, modename is the registered name of your module. By using &#8220;444&#8243; in module_param, we make this file writable. You can use &#8220;sudo echo &#8230; > /sys/&#8230;/mode&#8221; to change the content of this file.</p>
<p>When the file is changed, your module will also see the change. However, sysfs does NOT tell the module about this change. Therefore, in your code, you may have to proactively check its value. The code could be like this:</p>
<pre>
extern int mode;
static int old_mode=mode;
void thread_run(){ //a repeatedly running thread
       sleep(1);
       if (mode != old_mode){
               //code to handle mode change
               ...
               old_mode=mode;
       }
}
</pre>


<p>Related posts:<ol><li><a href='http://www.phacai.com/trouble-shooting-for-writing-your-first-linux-module-on-ubuntu' rel='bookmark' title='Permanent Link: Trouble shooting for writing your first Linux module on Ubuntu'>Trouble shooting for writing your first Linux module on Ubuntu</a></li>
<li><a href='http://www.phacai.com/write-to-a-file-in-php' rel='bookmark' title='Permanent Link: Write to a file in PHP'>Write to a file in PHP</a></li>
<li><a href='http://www.phacai.com/location-of-the-kernel-symbol-table-on-fedora-linux' rel='bookmark' title='Permanent Link: Location of the kernel symbol table on Fedora Linux'>Location of the kernel symbol table on Fedora Linux</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.phacai.com/write-a-kernel-module-that-its-parameters-can-be-dynamically-changed/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Location of the kernel symbol table on Fedora Linux</title>
		<link>http://www.phacai.com/location-of-the-kernel-symbol-table-on-fedora-linux</link>
		<comments>http://www.phacai.com/location-of-the-kernel-symbol-table-on-fedora-linux#comments</comments>
		<pubDate>Thu, 02 Feb 2012 17:04:01 +0000</pubDate>
		<dc:creator>Mr. One</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.phacai.com/?p=1277</guid>
		<description><![CDATA[check out /proc/kallsyms. You don&#8217;t have to be a root to read its content. The normal place &#8220;/proc/ksyms&#8221; does not exist on my Fedora. The content may look like this c0100000 T startup_32 c0100000 T _text c0100079 t bad_subarch c0100079 W lguest_entry c0100079 W xen_entry c010007b t default_entry c0101000 T wakeup_pmode_return c010104c t bogus_magic c010104e [...]


Related posts:<ol><li><a href='http://www.phacai.com/list-the-content-of-kernel-symbol-table' rel='bookmark' title='Permanent Link: List the content of Kernel Symbol Table'>List the content of Kernel Symbol Table</a></li>
<li><a href='http://www.phacai.com/linux-kernel-messages-are-not-printed-on-the-console' rel='bookmark' title='Permanent Link: Linux kernel messages are not printed on the console'>Linux kernel messages are not printed on the console</a></li>
<li><a href='http://www.phacai.com/the-documentlocation-in-javascript' rel='bookmark' title='Permanent Link: The document.location in JavaScript'>The document.location in JavaScript</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>check out /proc/kallsyms. You don&#8217;t have to be a root to read its content. The normal place &#8220;/proc/ksyms&#8221; does not exist on my Fedora.<br />
<span id="more-1277"></span><br />
The content may look like this</p>
<pre>
c0100000 T startup_32
c0100000 T _text
c0100079 t bad_subarch
c0100079 W lguest_entry
c0100079 W xen_entry
c010007b t default_entry
c0101000 T wakeup_pmode_return
c010104c t bogus_magic
c010104e t save_registers
c010109d t restore_registers
</pre>
<p>To understand the meaning of letters in the middle column, such as &#8220;T&#8221;, &#8220;t&#8221;, and &#8220;W&#8221;, you need to check out the manpage of &#8220;nm&#8221;.</p>


<p>Related posts:<ol><li><a href='http://www.phacai.com/list-the-content-of-kernel-symbol-table' rel='bookmark' title='Permanent Link: List the content of Kernel Symbol Table'>List the content of Kernel Symbol Table</a></li>
<li><a href='http://www.phacai.com/linux-kernel-messages-are-not-printed-on-the-console' rel='bookmark' title='Permanent Link: Linux kernel messages are not printed on the console'>Linux kernel messages are not printed on the console</a></li>
<li><a href='http://www.phacai.com/the-documentlocation-in-javascript' rel='bookmark' title='Permanent Link: The document.location in JavaScript'>The document.location in JavaScript</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.phacai.com/location-of-the-kernel-symbol-table-on-fedora-linux/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some notes about compiling DBT3 (TPC-H)</title>
		<link>http://www.phacai.com/some-notes-about-compiling-dbt3-tpc-h</link>
		<comments>http://www.phacai.com/some-notes-about-compiling-dbt3-tpc-h#comments</comments>
		<pubDate>Wed, 01 Feb 2012 17:13:25 +0000</pubDate>
		<dc:creator>Mr. One</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.phacai.com/?p=1275</guid>
		<description><![CDATA[As described in the INSTALL file, first run aclocal autoreconf --install In the process, you may need to install packages &#8220;automake&#8221; and &#8220;libtool&#8221;. The run ./configure --with-postgresql or &#8220;&#8211;with-mysql&#8221; or &#8220;&#8211;with-sapdb&#8221;. If you do not give the &#8220;with&#8221; parameter, the generated Makefile will not work correctly. Related posts:Error when compiling postgresql DBT3 (TPC-H) user manual [...]


Related posts:<ol><li><a href='http://www.phacai.com/error-when-compiling-postgresql' rel='bookmark' title='Permanent Link: Error when compiling postgresql'>Error when compiling postgresql</a></li>
<li><a href='http://www.phacai.com/dbt3-tpc-h-user-manual' rel='bookmark' title='Permanent Link: DBT3 (TPC-H) user manual'>DBT3 (TPC-H) user manual</a></li>
<li><a href='http://www.phacai.com/error-when-running-dbt2-cant-locate-testparserdbt2-pm-in-inc' rel='bookmark' title='Permanent Link: Error when running DBT2: &#8220;Can&#8217;t locate Test/Parser/Dbt2.pm in @INC&#8221;'>Error when running DBT2: &#8220;Can&#8217;t locate Test/Parser/Dbt2.pm in @INC&#8221;</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>As described in the INSTALL file, first run<br />
<span id="more-1275"></span></p>
<pre>
aclocal
autoreconf --install
</pre>
<p>In the process, you may need to install packages &#8220;automake&#8221; and &#8220;libtool&#8221;.</p>
<p>The run</p>
<pre>
./configure --with-postgresql
</pre>
<p>or &#8220;&#8211;with-mysql&#8221; or &#8220;&#8211;with-sapdb&#8221;. If you do not give the &#8220;with&#8221; parameter, the generated Makefile will not work correctly.</p>


<p>Related posts:<ol><li><a href='http://www.phacai.com/error-when-compiling-postgresql' rel='bookmark' title='Permanent Link: Error when compiling postgresql'>Error when compiling postgresql</a></li>
<li><a href='http://www.phacai.com/dbt3-tpc-h-user-manual' rel='bookmark' title='Permanent Link: DBT3 (TPC-H) user manual'>DBT3 (TPC-H) user manual</a></li>
<li><a href='http://www.phacai.com/error-when-running-dbt2-cant-locate-testparserdbt2-pm-in-inc' rel='bookmark' title='Permanent Link: Error when running DBT2: &#8220;Can&#8217;t locate Test/Parser/Dbt2.pm in @INC&#8221;'>Error when running DBT2: &#8220;Can&#8217;t locate Test/Parser/Dbt2.pm in @INC&#8221;</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.phacai.com/some-notes-about-compiling-dbt3-tpc-h/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DBT3 (TPC-H) user manual</title>
		<link>http://www.phacai.com/dbt3-tpc-h-user-manual</link>
		<comments>http://www.phacai.com/dbt3-tpc-h-user-manual#comments</comments>
		<pubDate>Wed, 01 Feb 2012 15:36:17 +0000</pubDate>
		<dc:creator>Mr. One</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.phacai.com/?p=1271</guid>
		<description><![CDATA[I just want to post it here, so I don&#8217;t need to compile from source every time: dbt3-user (pdf) Related posts:Some notes about compiling DBT3 (TPC-H)


Related posts:<ol><li><a href='http://www.phacai.com/some-notes-about-compiling-dbt3-tpc-h' rel='bookmark' title='Permanent Link: Some notes about compiling DBT3 (TPC-H)'>Some notes about compiling DBT3 (TPC-H)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I just want to post it here, so I don&#8217;t need to compile from source every time:<br />
<a href='http://www.phacai.com/wp-content/uploads/2012/02/dbt3-user.pdf'>dbt3-user (pdf)</a></p>


<p>Related posts:<ol><li><a href='http://www.phacai.com/some-notes-about-compiling-dbt3-tpc-h' rel='bookmark' title='Permanent Link: Some notes about compiling DBT3 (TPC-H)'>Some notes about compiling DBT3 (TPC-H)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.phacai.com/dbt3-tpc-h-user-manual/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Control flow of a query in PostgreSQL</title>
		<link>http://www.phacai.com/contrl-flow-of-a-query-in-postgresql</link>
		<comments>http://www.phacai.com/contrl-flow-of-a-query-in-postgresql#comments</comments>
		<pubDate>Fri, 27 Jan 2012 19:27:36 +0000</pubDate>
		<dc:creator>Mr. One</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.phacai.com/?p=1255</guid>
		<description><![CDATA[As of version 9.0.4 (source: src/backend/executor/README) (1) CreateQueryDesc (tcop/pquery.c) (2) ExecutorStart (executor/execMain.c) (2.1) CreateExecutorState (executor/execUtils.c) (2.2) ExecInitNode (executor/execProcnode.c) (2.2.1) CreateExprContext (executor/execUtils.c) (2.2.2) ExecInitExpr (executor/execQual.c) (3) ExecutorRun (executor/execMain.c) (3.1) ExecProcNode (executor/execProcnode.c) (3.1.1) ExecEvalExpr (include/executor/executor.h) (3.1.2) ResetExprContext (include/executor/executor.h) (4) ExecutorEnd (executor/execMain.c) (4.1) ExecEndNode (executor/execProcnode.c) (4.2) FreeExecutorState (executor/execUtils.c) (5) FreeQueryDesc (tcop/pquery.c) &#8220;CreateQueryDesc&#8221; is will be invoked through a [...]


Related posts:<ol><li><a href='http://www.phacai.com/a-tpc-h-q21-query-plan' rel='bookmark' title='Permanent Link: A TPC-H Q21 query plan'>A TPC-H Q21 query plan</a></li>
<li><a href='http://www.phacai.com/error-when-compiling-postgresql' rel='bookmark' title='Permanent Link: Error when compiling postgresql'>Error when compiling postgresql</a></li>
<li><a href='http://www.phacai.com/how-to-debug-postgresql-during-initdb' rel='bookmark' title='Permanent Link: How to debug postgresql during initdb'>How to debug postgresql during initdb</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>As of version 9.0.4<br />
<span id="more-1255"></span><br />
(source: src/backend/executor/README)</p>
<pre>
(1) CreateQueryDesc (tcop/pquery.c)
(2) ExecutorStart (executor/execMain.c)
    (2.1) CreateExecutorState (executor/execUtils.c)
    (2.2) ExecInitNode (executor/execProcnode.c)
        (2.2.1) CreateExprContext (executor/execUtils.c)
        (2.2.2) ExecInitExpr (executor/execQual.c)
(3) ExecutorRun (executor/execMain.c)
    (3.1) ExecProcNode (executor/execProcnode.c)
        (3.1.1) ExecEvalExpr (include/executor/executor.h)
        (3.1.2) ResetExprContext (include/executor/executor.h)
(4) ExecutorEnd (executor/execMain.c)
    (4.1) ExecEndNode (executor/execProcnode.c)
    (4.2) FreeExecutorState (executor/execUtils.c)
(5) FreeQueryDesc (tcop/pquery.c)
</pre>
<p>&#8220;CreateQueryDesc&#8221; is will be invoked through a series of calls following</p>
<pre>
exec_simple_query (tcop/postgres.c)
|->1. pg_analyze_and_rewrite (tcop/postgres.c)
|->2. pg_plan_queries (tcop/postgres.c)
|->3. PortalStart (tcop/pquery.c)
|-----> ...
</pre>
<p>&#8220;A portal is an abstraction which represents the execution state of a running or runnable query.&#8221; &#8212; &#8220;include/utils/portal.h&#8221;. In the comments of the header file, we can see the strategies used by different types of queries.</p>


<p>Related posts:<ol><li><a href='http://www.phacai.com/a-tpc-h-q21-query-plan' rel='bookmark' title='Permanent Link: A TPC-H Q21 query plan'>A TPC-H Q21 query plan</a></li>
<li><a href='http://www.phacai.com/error-when-compiling-postgresql' rel='bookmark' title='Permanent Link: Error when compiling postgresql'>Error when compiling postgresql</a></li>
<li><a href='http://www.phacai.com/how-to-debug-postgresql-during-initdb' rel='bookmark' title='Permanent Link: How to debug postgresql during initdb'>How to debug postgresql during initdb</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.phacai.com/contrl-flow-of-a-query-in-postgresql/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adjust Vim split window size</title>
		<link>http://www.phacai.com/adjust-vim-split-window-size</link>
		<comments>http://www.phacai.com/adjust-vim-split-window-size#comments</comments>
		<pubDate>Wed, 18 Jan 2012 20:32:59 +0000</pubDate>
		<dc:creator>Mr. One</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.phacai.com/?p=1250</guid>
		<description><![CDATA[1. Change the height (number of rows) of a split window To increase by 10, type command :res+10 To decrease by 10, type command :res-10 2. Change the width (number of columns) of a split window To increase by 10, type command :vertical res+10 To decrease by 10, type command :vertical res-10 Please note that [...]


Related posts:<ol><li><a href='http://www.phacai.com/adjust-partitions-in-ubuntu-on-the-fly' rel='bookmark' title='Permanent Link: Adjust Partitions in Ubuntu on the fly'>Adjust Partitions in Ubuntu on the fly</a></li>
<li><a href='http://www.phacai.com/split-one-text-file-into-multiple-ones-with-shell-script' rel='bookmark' title='Permanent Link: Split one text file into multiple ones, with Shell script'>Split one text file into multiple ones, with Shell script</a></li>
<li><a href='http://www.phacai.com/vim-nerdtree-cheat-sheet' rel='bookmark' title='Permanent Link: vim NERDTree cheat sheet'>vim NERDTree cheat sheet</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><strong>1. Change the height (number of rows) of a split window</strong><br />
To increase by 10, type command</p>
<pre>
:res+10
</pre>
<p><span id="more-1250"></span><br />
To decrease by 10, type command</p>
<pre>
:res-10
</pre>
<p><br/></p>
<p><strong>2. Change the width (number of columns) of a split window</strong><br />
To increase by 10, type command</p>
<pre>
:vertical res+10
</pre>
<p>To decrease by 10, type command</p>
<pre>
:vertical res-10
</pre>
<p><br/></p>
<p>Please note that some people use &#8220;<Ctrl>+W&#8221; shortcuts to do the same job, but I am having trouble when using these shortcuts. So I just stick to changing the size by typing the commands.</p>


<p>Related posts:<ol><li><a href='http://www.phacai.com/adjust-partitions-in-ubuntu-on-the-fly' rel='bookmark' title='Permanent Link: Adjust Partitions in Ubuntu on the fly'>Adjust Partitions in Ubuntu on the fly</a></li>
<li><a href='http://www.phacai.com/split-one-text-file-into-multiple-ones-with-shell-script' rel='bookmark' title='Permanent Link: Split one text file into multiple ones, with Shell script'>Split one text file into multiple ones, with Shell script</a></li>
<li><a href='http://www.phacai.com/vim-nerdtree-cheat-sheet' rel='bookmark' title='Permanent Link: vim NERDTree cheat sheet'>vim NERDTree cheat sheet</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.phacai.com/adjust-vim-split-window-size/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A TPC-H Q21 query plan</title>
		<link>http://www.phacai.com/a-tpc-h-q21-query-plan</link>
		<comments>http://www.phacai.com/a-tpc-h-q21-query-plan#comments</comments>
		<pubDate>Sun, 27 Nov 2011 19:34:19 +0000</pubDate>
		<dc:creator>Mr. One</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.phacai.com/?p=1245</guid>
		<description><![CDATA[Configuration: PostgreSQL 9.0.4. memsize/data size = 1/8 Query select s_name, count(*) as numwait from supplier, lineitem l1, orders, nation where s_suppkey = l1.l_suppkey and o_orderkey = l1.l_orderkey and o_orderstatus = 'F' and l1.l_receiptdate > l1.l_commitdate and exists ( select * from lineitem l2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey l1.l_suppkey ) and not exists ( [...]


Related posts:<ol><li><a href='http://www.phacai.com/contrl-flow-of-a-query-in-postgresql' rel='bookmark' title='Permanent Link: Control flow of a query in PostgreSQL'>Control flow of a query in PostgreSQL</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Configuration:<br />
PostgreSQL 9.0.4. memsize/data size = 1/8<br />
<span id="more-1245"></span><br />
Query</p>
<pre>
select
        s_name,
        count(*) as numwait
from
        supplier,
        lineitem l1,
        orders,
        nation
where
        s_suppkey = l1.l_suppkey
        and o_orderkey = l1.l_orderkey
        and o_orderstatus = 'F'
        and l1.l_receiptdate > l1.l_commitdate
        and exists (
                select
                        *
                from
                        lineitem l2
                where
                        l2.l_orderkey = l1.l_orderkey
                        and l2.l_suppkey <> l1.l_suppkey
        )
        and not exists (
                select
                        *
                from
                        lineitem l3
                where
                        l3.l_orderkey = l1.l_orderkey
                        and l3.l_suppkey <> l1.l_suppkey
                        and l3.l_receiptdate > l3.l_commitdate
        )
        and s_nationkey = n_nationkey
        and n_name = 'BRAZIL'
group by
        s_name
order by
        numwait desc,
        s_name;
</pre>
<p>Query plan</p>
<div class="hl-surround">
<ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)">
<li class="hl-firstline">Sort&nbsp; (cost=5009298.60..5009298.60 rows=1 width=26)</li>
<li>&nbsp;&nbsp; Sort Key: (count(*)), supplier.s_name</li>
<li>&nbsp;&nbsp; -&gt;&nbsp; HashAggregate&nbsp; (cost=5009298.58..5009298.59 rows=1 width=26)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; -&gt;&nbsp; Nested Loop Anti Join&nbsp; (cost=2757689.50..5009298.57 rows=1 width=26)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Join Filter: (l3.l_suppkey &lt;&gt; l1.l_suppkey)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;&nbsp; Nested Loop&nbsp; (cost=2757689.50..5009241.82 rows=1 width=34)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;&nbsp; Hash Semi Join&nbsp; (cost=2757689.50..5009232.22 rows=1 width=38)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hash Cond: (l1.l_orderkey = l2.l_orderkey)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Join Filter: (l2.l_suppkey &lt;&gt; l1.l_suppkey)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;&nbsp; Hash Join&nbsp; (cost=3684.32..2006488.68 rows=799814 width=34)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hash Cond: (l1.l_suppkey = supplier.s_suppkey)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;&nbsp; Seq Scan on lineitem l1&nbsp; (cost=0.00..1919823.65 rows=19995351 width=8)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Filter: (l_receiptdate &gt; l_commitdate)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;&nbsp; Hash&nbsp; (cost=3634.32..3634.32 rows=4000 width=30)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;&nbsp; Hash Join&nbsp; (cost=1.32..3634.32 rows=4000 width=30)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hash Cond: (supplier.s_nationkey = nation.n_nationkey)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;&nbsp; Seq Scan on supplier&nbsp; (cost=0.00..3218.00 rows=100000 width=34)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;&nbsp; Hash&nbsp; (cost=1.31..1.31 rows=1 width=4)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;&nbsp; Seq Scan on nation&nbsp; (cost=0.00..1.31 rows=1 width=4)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Filter: (n_name = &#8216;BRAZIL&#8217;::bpchar)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;&nbsp; Hash&nbsp; (cost=1769858.52..1769858.52 rows=59986052 width=8)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;&nbsp; Seq Scan on lineitem l2&nbsp; (cost=0.00..1769858.52 rows=59986052 width=8)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;&nbsp; Index Scan using o_orderkey_idx on orders&nbsp; (cost=0.00..9.59 rows=1 width=4)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Index Cond: (orders.o_orderkey = l1.l_orderkey)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Filter: (orders.o_orderstatus = &#8216;F&#8217;::bpchar)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;&nbsp; Index Scan using l_orderkey_idx on lineitem l3&nbsp; (cost=0.00..27.98 rows=52 width=8)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Index Cond: (l3.l_orderkey = l1.l_orderkey)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Filter: (l3.l_receiptdate &gt; l3.l_commitdate)</li>
</ol>
</div>


<p>Related posts:<ol><li><a href='http://www.phacai.com/contrl-flow-of-a-query-in-postgresql' rel='bookmark' title='Permanent Link: Control flow of a query in PostgreSQL'>Control flow of a query in PostgreSQL</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.phacai.com/a-tpc-h-q21-query-plan/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

