<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	>
<channel>
	<title>Comments on: SQLite performance tuning and optimization on embedded systems</title>
	<atom:link href="http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/feed/" rel="self" type="application/rss+xml" />
	<link>http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/</link>
	<description>Chaotic solutions and random thoughts from the restless mind of a notorious problem solver (TM), by Andre Beckedorf</description>
	<pubDate>Wed, 07 Jan 2009 00:36:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Songbird Blog &#187; Performance Improvements for 1.0</title>
		<link>http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/comment-page-1/#comment-22751</link>
		<dc:creator>Songbird Blog &#187; Performance Improvements for 1.0</dc:creator>
		<pubDate>Thu, 27 Nov 2008 01:42:30 +0000</pubDate>
		<guid isPermaLink="false">http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/#comment-22751</guid>
		<description>[...] SQLite performance tuning and optimization on embedded systems [...]</description>
		<content:encoded><![CDATA[<p>[...] SQLite performance tuning and optimization on embedded systems [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kalyani</title>
		<link>http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/comment-page-1/#comment-11536</link>
		<dc:creator>kalyani</dc:creator>
		<pubDate>Wed, 30 May 2007 11:36:13 +0000</pubDate>
		<guid isPermaLink="false">http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/#comment-11536</guid>
		<description>Hi Andre,
Have you done any memory profiling on sqlite? Do you any optimization steps for reducing heap usage with out degrading performance and have least foot print.</description>
		<content:encoded><![CDATA[<p>Hi Andre,<br />
Have you done any memory profiling on sqlite? Do you any optimization steps for reducing heap usage with out degrading performance and have least foot print.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andre</title>
		<link>http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/comment-page-1/#comment-5139</link>
		<dc:creator>Andre</dc:creator>
		<pubDate>Mon, 05 Mar 2007 23:07:30 +0000</pubDate>
		<guid isPermaLink="false">http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/#comment-5139</guid>
		<description>Thanks for the comment, Dave.
Well, it largely depends on the use case and that's what I failed to point out.
I agree, for joining of big tables it's probably necessary to add an index on the hashkey to at least one table assuming the table order in the query is right. For lookups via the hash value of the string an index would also be required, otherwise performance will be sacrificed.
And even with an index on the hash value, my experience is, it's still a bit faster - provided that the hash value is an integer. I can only assume this is because indices on integers are more efficient than those on strings.

Also, I haven't been clear here: Having hashkeys over indices pays off for smaller tables, especially for temporary tables storing small amounts of intermediate results. Selects and joins without an index seem to be faster here compared to the overall time needed for setting up the index again and looking up in the index. It all depends on how much entries you have.

Here is an example for a different use case:
When reading a playlist, my media player has to lookup metadata for each filename in the playlist within the DB.
The problem is, the filename isn't saved in one place within the DB. Actually the filename is split into location/dirname and basename, both of which are kept in separate tables for space-saving reasons. I can't directly use an index here. I have to split up the filename and do an indexed lookup for each part over two tables. This is slower then using the hashkey approach with its preliminaries.
That's why I'm hashing the filename in my application to a 32-bit int. The same method is used when updating and adding new entries to the metadata table.

But then again, everything depends on the datastructures and the requirements of the application, whether a hashkey approach might be better or not.

Andre</description>
		<content:encoded><![CDATA[<p>Thanks for the comment, Dave.<br />
Well, it largely depends on the use case and that&#8217;s what I failed to point out.<br />
I agree, for joining of big tables it&#8217;s probably necessary to add an index on the hashkey to at least one table assuming the table order in the query is right. For lookups via the hash value of the string an index would also be required, otherwise performance will be sacrificed.<br />
And even with an index on the hash value, my experience is, it&#8217;s still a bit faster - provided that the hash value is an integer. I can only assume this is because indices on integers are more efficient than those on strings.</p>
<p>Also, I haven&#8217;t been clear here: Having hashkeys over indices pays off for smaller tables, especially for temporary tables storing small amounts of intermediate results. Selects and joins without an index seem to be faster here compared to the overall time needed for setting up the index again and looking up in the index. It all depends on how much entries you have.</p>
<p>Here is an example for a different use case:<br />
When reading a playlist, my media player has to lookup metadata for each filename in the playlist within the DB.<br />
The problem is, the filename isn&#8217;t saved in one place within the DB. Actually the filename is split into location/dirname and basename, both of which are kept in separate tables for space-saving reasons. I can&#8217;t directly use an index here. I have to split up the filename and do an indexed lookup for each part over two tables. This is slower then using the hashkey approach with its preliminaries.<br />
That&#8217;s why I&#8217;m hashing the filename in my application to a 32-bit int. The same method is used when updating and adding new entries to the metadata table.</p>
<p>But then again, everything depends on the datastructures and the requirements of the application, whether a hashkey approach might be better or not.</p>
<p>Andre</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Gauthier</title>
		<link>http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/comment-page-1/#comment-5132</link>
		<dc:creator>Dave Gauthier</dc:creator>
		<pubDate>Mon, 05 Mar 2007 15:41:42 +0000</pubDate>
		<guid isPermaLink="false">http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/#comment-5132</guid>
		<description>I'm not clear on the suggestion regarding the use of hashkeys.  Are you proposing using a smaller/leaner hashkey in place of long strings as primary/foreign keys?  If so, after you generate &#38; store the hashkeys in the primary &#38; foreign tables, wouldn't you still need to create an index on the hashkey columns and "join" the tables via that column in order to leverage it at query time?</description>
		<content:encoded><![CDATA[<p>I&#8217;m not clear on the suggestion regarding the use of hashkeys.  Are you proposing using a smaller/leaner hashkey in place of long strings as primary/foreign keys?  If so, after you generate &amp; store the hashkeys in the primary &amp; foreign tables, wouldn&#8217;t you still need to create an index on the hashkey columns and &#8220;join&#8221; the tables via that column in order to leverage it at query time?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: “Yet Another Zaurus Media Player”… done differently . (Phase 2: &#8220;Development progress, no release yet.&#8221;) at Katastrophos.net Blog</title>
		<link>http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/comment-page-1/#comment-2472</link>
		<dc:creator>“Yet Another Zaurus Media Player”… done differently . (Phase 2: &#8220;Development progress, no release yet.&#8221;) at Katastrophos.net Blog</dc:creator>
		<pubDate>Thu, 04 Jan 2007 10:33:31 +0000</pubDate>
		<guid isPermaLink="false">http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/#comment-2472</guid>
		<description>[...] Software          &#171; &#8220;Yet Another Zaurus Media Player&#8221;&#8230; done differently . (Phase 1: Teasing) SQLite performance tuning and optimization on embedded systems &#187; [...]</description>
		<content:encoded><![CDATA[<p>[...] Software          &laquo; &#8220;Yet Another Zaurus Media Player&#8221;&#8230; done differently . (Phase 1: Teasing) SQLite performance tuning and optimization on embedded systems &raquo; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQLite simple timing profiler patch at Katastrophos.net Blog</title>
		<link>http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/comment-page-1/#comment-2469</link>
		<dc:creator>SQLite simple timing profiler patch at Katastrophos.net Blog</dc:creator>
		<pubDate>Thu, 04 Jan 2007 10:27:21 +0000</pubDate>
		<guid isPermaLink="false">http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/#comment-2469</guid>
		<description>[...] Software          &#171; SQLite performance tuning and optimization on embedded systems [...]</description>
		<content:encoded><![CDATA[<p>[...] Software          &laquo; SQLite performance tuning and optimization on embedded systems [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andre</title>
		<link>http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/comment-page-1/#comment-2462</link>
		<dc:creator>Andre</dc:creator>
		<pubDate>Thu, 04 Jan 2007 06:42:29 +0000</pubDate>
		<guid isPermaLink="false">http://katastrophos.net/andre/blog/2007/01/04/sqlite-performance-tuning-and-optimization-on-embedded-systems/#comment-2462</guid>
		<description>Here are the flags I'm currently using for my Zaurus:

-DSQLITE_OMIT_UTF16 -DSQLITE_OMIT_AUTHORIZATION -DSQLITE_OMIT_PROGRESS_CALLBACK \
-DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DNDEBUG \
-march=armv4 -mtune=strongarm -O3 -fomit-frame-pointer

Compiler is GCC 2.95.3. Over -O2 these flags reduced the execution time of my SQL testsuite from 1040 ms down to 880 ms. This is caused mostly due to the function inlining and architecture optimization.
Unrolling loops will hurt performance in most cases. Your mileage may vary.</description>
		<content:encoded><![CDATA[<p>Here are the flags I&#8217;m currently using for my Zaurus:</p>
<p>-DSQLITE_OMIT_UTF16 -DSQLITE_OMIT_AUTHORIZATION -DSQLITE_OMIT_PROGRESS_CALLBACK \<br />
-DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DNDEBUG \<br />
-march=armv4 -mtune=strongarm -O3 -fomit-frame-pointer</p>
<p>Compiler is GCC 2.95.3. Over -O2 these flags reduced the execution time of my SQL testsuite from 1040 ms down to 880 ms. This is caused mostly due to the function inlining and architecture optimization.<br />
Unrolling loops will hurt performance in most cases. Your mileage may vary.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
