<?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>entwicklungsgedanken &#187; index</title>
	<atom:link href="http://www.entwicklungsgedanken.de/tag/index/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.entwicklungsgedanken.de</link>
	<description>Verschiedene Gedanken rund um die Softwareentwicklung</description>
	<lastBuildDate>Mon, 09 Jan 2012 14:47:42 +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>Allowing PostgreSQL to use an index when the query uses the LIKE-operator</title>
		<link>http://www.entwicklungsgedanken.de/2009/08/05/allowing-postgresql-to-use-an-index-when-the-query-uses-the-like-operator/</link>
		<comments>http://www.entwicklungsgedanken.de/2009/08/05/allowing-postgresql-to-use-an-index-when-the-query-uses-the-like-operator/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 18:31:14 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Webdevelopment]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[like]]></category>
		<category><![CDATA[operator class]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[wildcard]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=312</guid>
		<description><![CDATA[When enabling search in database its very important to have the appropriate indexes defined to make the queries as fast as possible. If your query looks like this (and the appropriate index is defined) the index can be used by the database (the query planner) even with the LIKE-operator. So fast wildcard-searches are possible &#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>When enabling search in database its very important to have the appropriate indexes defined to make the queries as fast as possible. If your query looks like this (and the appropriate index is defined) the index can be used by the database (the query planner) even with the <code>LIKE</code>-operator. So fast wildcard-searches are possible &#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> col1 <span style="color: #993333; font-weight: bold;">FROM</span> foobar <span style="color: #993333; font-weight: bold;">WHERE</span> col1 <span style="color: #993333; font-weight: bold;">LIKE</span> <span style="color: #ff0000;">'1234%'</span>;</pre></div></div>

<h3>Yes?! Really?!</h3>
<p>In one of our production systems this kind of query (when debugged via <code>EXPLAIN</code> / <code>EXPLAIN ANALYZE</code>) return unexpected results. Every time our comparison operator turns from equality <code>=</code> into <code>LIKE</code> the index for the column is fully ignored and instead a full-table scan (sequential scan) is used by the planner. Things are really slow &#8230;</p>
<h3>I locale you!</h3>
<p>After asking Google its seems some more people having this issue, too.<br />Our database-cluster was initialized with the locale de_DE.utf8. A quick view into the excellent documentation for <code>CREATE INDEX</code> revealed there is an <a href="http://www.postgresql.org/docs/8.3/interactive/indexes-opclass.html">operator class</a> which controls the operators of the index. After adding an index with an operator class for that column the index (&#8220;FoobarWildcardIdx&#8221;) is now used even when the query contains <code>LIKE</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">INDEX</span> FoobarWildcardIdx <span style="color: #993333; font-weight: bold;">ON</span> foobar <span style="color: #66cc66;">&#40;</span>col1 varchar_pattern_ops<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2009/08/05/allowing-postgresql-to-use-an-index-when-the-query-uses-the-like-operator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cannot complete this action &#8211; error when adding a ContentType to a list</title>
		<link>http://www.entwicklungsgedanken.de/2008/07/20/cannot-complete-this-action-error-when-adding-a-contenttype-to-a-list/</link>
		<comments>http://www.entwicklungsgedanken.de/2008/07/20/cannot-complete-this-action-error-when-adding-a-contenttype-to-a-list/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 19:21:03 +0000</pubDate>
		<dc:creator>Eric Bartels</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint-Development]]></category>
		<category><![CDATA[ContentType]]></category>
		<category><![CDATA[custom field]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[lookup]]></category>

		<guid isPermaLink="false">http://www.entwicklungsgedanken.de/?p=52</guid>
		<description><![CDATA[Today I got a nice error from my SharePoint development box after I tried to add a certain Content Type to a list. Cannot complete this action. Please try again. at Microsoft.SharePoint.Library.SPRequestInternalClass.AddField&#40;String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd&#41; at Microsoft.SharePoint.Library.SPRequest.AddField&#40;String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd&#41; Tell me This is an error message [...]]]></description>
			<content:encoded><![CDATA[<p>Today I got a nice error from my SharePoint development box after I tried to add a certain Content Type to a list.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">Cannot complete <span style="color: #0600FF; font-weight: bold;">this</span> action<span style="color: #008000;">.</span> <span style="color: #0000FF;">Please</span> <span style="color: #0600FF; font-weight: bold;">try</span> again<span style="color: #008000;">.</span> <span style="color: #0000FF;">at</span> Microsoft<span style="color: #008000;">.</span><span style="color: #0000FF;">SharePoint</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Library</span><span style="color: #008000;">.</span><span style="color: #0000FF;">SPRequestInternalClass</span><span style="color: #008000;">.</span><span style="color: #0000FF;">AddField</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">String</span> bstrUrl, <span style="color: #6666cc; font-weight: bold;">String</span> bstrListName, <span style="color: #6666cc; font-weight: bold;">String</span> bstrSchemaXml, Int32 grfAdd<span style="color: #008000;">&#41;</span> 
   at Microsoft<span style="color: #008000;">.</span><span style="color: #0000FF;">SharePoint</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Library</span><span style="color: #008000;">.</span><span style="color: #0000FF;">SPRequest</span><span style="color: #008000;">.</span><span style="color: #0000FF;">AddField</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">String</span> bstrUrl, <span style="color: #6666cc; font-weight: bold;">String</span> bstrListName, <span style="color: #6666cc; font-weight: bold;">String</span> bstrSchemaXml, Int32 grfAdd<span style="color: #008000;">&#41;</span></pre></div></div>

<h3>Tell me</h3>
<p>
This is an error message every developer fells in love with. Its full of nothing&#8230;</p>
<p>
Further analysis revealed that there must be a problem with a custom field definition inside that Content Type. Even more investigation found the culprit.
</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Field</span> <span style="color: #000066;">Type</span>=<span style="color: #ff0000;">&quot;LookupMulti&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">DisplayName</span>=<span style="color: #ff0000;">&quot;CustomField&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">Required</span>=<span style="color: #ff0000;">&quot;FALSE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">Description</span>=<span style="color: #ff0000;">&quot;My custom field&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">Group</span>=<span style="color: #ff0000;">&quot;Custom&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">StaticName</span>=<span style="color: #ff0000;">&quot;MyCustomField&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;MyCustomField&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">ShowField</span>=<span style="color: #ff0000;">&quot;Title&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">ShowInDisplayForm</span>=<span style="color: #ff0000;">&quot;TRUE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">ShowInEditForm</span>=<span style="color: #ff0000;">&quot;TRUE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">ShowInNewForm</span>=<span style="color: #ff0000;">&quot;TRUE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">ShowInViewForms</span>=<span style="color: #ff0000;">&quot;TRUE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">Mult</span>=<span style="color: #ff0000;">&quot;TRUE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">Sortable</span>=<span style="color: #ff0000;">&quot;FALSE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">Indexed</span>=<span style="color: #ff0000;">&quot;TRUE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">UnlimitedLengthInDocumentLibrary</span>=<span style="color: #ff0000;">&quot;TRUE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">List</span>=<span style="color: #ff0000;">&quot;myList&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">SourceID</span>=<span style="color: #ff0000;">&quot;{31DCE571-D649-41b8-99D7-448F43FCEAC0}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<h3>Conclusion</h3>
<p>
<strong>NEVER</strong> set the attribute <code>Indexed</code> to <code>TRUE</code> when the field is a Lookup-Field that has the <code>Mult</code>-attribute set to <code>TRUE</code>!
</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Field</span> <span style="color: #000066;">Type</span>=<span style="color: #ff0000;">&quot;LookupMulti&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">DisplayName</span>=<span style="color: #ff0000;">&quot;CustomField&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">Required</span>=<span style="color: #ff0000;">&quot;FALSE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">Description</span>=<span style="color: #ff0000;">&quot;My custom field&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">Group</span>=<span style="color: #ff0000;">&quot;Custom&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">StaticName</span>=<span style="color: #ff0000;">&quot;MyCustomField&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;MyCustomField&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">ShowField</span>=<span style="color: #ff0000;">&quot;Title&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">ShowInDisplayForm</span>=<span style="color: #ff0000;">&quot;TRUE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">ShowInEditForm</span>=<span style="color: #ff0000;">&quot;TRUE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">ShowInNewForm</span>=<span style="color: #ff0000;">&quot;TRUE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">ShowInViewForms</span>=<span style="color: #ff0000;">&quot;TRUE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">Mult</span>=<span style="color: #ff0000;">&quot;TRUE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">Sortable</span>=<span style="color: #ff0000;">&quot;FALSE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">Indexed</span>=<span style="color: #ff0000;">&quot;FALSE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">UnlimitedLengthInDocumentLibrary</span>=<span style="color: #ff0000;">&quot;TRUE&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">List</span>=<span style="color: #ff0000;">&quot;myList&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">SourceID</span>=<span style="color: #ff0000;">&quot;{31DCE571-D649-41b8-99D7-448F43FCEAC0}&quot;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.entwicklungsgedanken.de/2008/07/20/cannot-complete-this-action-error-when-adding-a-contenttype-to-a-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

