diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeTranslatedSimulationStateTitleSearchQuery.catalog_keys.xml b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeTranslatedSimulationStateTitleSearchQuery.catalog_keys.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a540f9431e9c394244ed71562b197938e6fe9258
--- /dev/null
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeTranslatedSimulationStateTitleSearchQuery.catalog_keys.xml
@@ -0,0 +1,2 @@
+<catalog_method>
+</catalog_method>
diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeTranslatedSimulationStateTitleSearchQuery.xml b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeTranslatedSimulationStateTitleSearchQuery.xml
new file mode 100644
index 0000000000000000000000000000000000000000..328984f968ad3d38d5d24be18efee35d78664c35
--- /dev/null
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_makeTranslatedSimulationStateTitleSearchQuery.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_body</string> </key>
+            <value> <string>from Products.ZSQLCatalog.SQLCatalog import Query, AndQuery\n
+\n
+possible_simulation_state_list = [brain.original_message for brain in context.SQLCatalog_zGetPossibleSimulationState(translated_message=value)]\n
+\n
+return AndQuery(Query(translated_simulation_state_title__=value),\n
+                Query(simulation_state=possible_simulation_state_list))\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>value</string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>SQLCatalog_makeTranslatedSimulationStateTitleSearchQuery</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_zGetPossibleSimulationState.catalog_keys.xml b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_zGetPossibleSimulationState.catalog_keys.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a540f9431e9c394244ed71562b197938e6fe9258
--- /dev/null
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_zGetPossibleSimulationState.catalog_keys.xml
@@ -0,0 +1,2 @@
+<catalog_method>
+</catalog_method>
diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_zGetPossibleSimulationState.xml b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_zGetPossibleSimulationState.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5f513304bb510d912ea61808cad2af95bb1423f4
--- /dev/null
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_zGetPossibleSimulationState.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="SQL" module="Products.ZSQLMethods.SQL"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_col</string> </key>
+            <value>
+              <list>
+                <dictionary>
+                  <item>
+                      <key> <string>name</string> </key>
+                      <value> <string>original_message</string> </value>
+                  </item>
+                  <item>
+                      <key> <string>null</string> </key>
+                      <value> <int>1</int> </value>
+                  </item>
+                  <item>
+                      <key> <string>type</string> </key>
+                      <value> <string>t</string> </value>
+                  </item>
+                  <item>
+                      <key> <string>width</string> </key>
+                      <value> <int>8</int> </value>
+                  </item>
+                </dictionary>
+              </list>
+            </value>
+        </item>
+        <item>
+            <key> <string>arguments_src</string> </key>
+            <value> <string>translated_message</string> </value>
+        </item>
+        <item>
+            <key> <string>connection_id</string> </key>
+            <value> <string>erp5_sql_connection</string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>SQLCatalog_zGetPossibleSimulationState</string> </value>
+        </item>
+        <item>
+            <key> <string>src</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+select distinct original_message from translation\n
+where\n
+message_context = "simulation_state_title"\n
+and\n
+language = <dtml-sqlvar "Localizer.get_selected_language()" type="string">\n
+and\n
+<dtml-sqltest translated_message op=like type=string>
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogRelatedKeyTemplateItem/related_key_list.xml b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogRelatedKeyTemplateItem/related_key_list.xml
index dbe4805dfc1cdd93981e98c33f297ea1499f220f..6a81e1c2c67ad137a082a798a85de8272d287b96 100644
--- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogRelatedKeyTemplateItem/related_key_list.xml
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogRelatedKeyTemplateItem/related_key_list.xml
@@ -56,7 +56,7 @@
  <key>translated_opportunity_state_title | translation/translated_message/z_related_translated_opportunity_state_title</key>
  <key>translated_portal_type | translation/translated_message/z_related_translated_portal_type</key>
  <key>translated_simulation_state | translation/translated_message/z_related_translated_simulation_state</key>
- <key>translated_simulation_state_title | translation/translated_message/z_related_translated_simulation_state_title</key>
+ <key>translated_simulation_state_title__ | translation/translated_message/z_related_translated_simulation_state_title</key>
  <key>translated_validation_state | translation/translated_message/z_related_translated_validation_state</key>
  <key>translated_validation_state_title | translation/translated_message/z_related_translated_validation_state_title</key>
  <key>variationCategory | category/category_uid/z_related_uid</key>
diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogScriptableKeyTemplateItem/scriptable_key_list.xml b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogScriptableKeyTemplateItem/scriptable_key_list.xml
index 264b1376532a61f81f9be77f8b8a0d290b34260d..90a55f4f76e7a9ee3465a65b5cf0c29dc5eb8373 100644
--- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogScriptableKeyTemplateItem/scriptable_key_list.xml
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogScriptableKeyTemplateItem/scriptable_key_list.xml
@@ -3,4 +3,5 @@
  <key>full_text | SQLCatalog_makeFullTextQuery</key>
  <key>quick_search_text | SQLCatalog_makeQuickSearchQuery</key>
  <key>search_text | SQLCatalog_makeSearchTextQuery</key>
+ <key>translated_simulation_state_title | SQLCatalog_makeTranslatedSimulationStateTitleSearchQuery</key>
 </key_list>
\ No newline at end of file
diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/change_log b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/change_log
index 7fa0759d5926c86f08de545d7a3e2884f16562fc..26320816be2df33d0aac1962a22796c6c5bcf977 100644
--- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/change_log
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/change_log
@@ -1,3 +1,6 @@
+2013-06-12 yusei
+* Replace a zsqlmethod for translated_simulation_state_title with python script to add an extra condition to where expression. This helps mysql optimizer to make a better plan. Without it mysql optimizer may make a bad plan to join catalog and translation and causes bad performance problem.
+
 2013-05-30 yusei
 * Fix an inventory bug. When there are more than 300 inventories which are cancelled by inventory document, inventory document creates wrong stock records.
 
diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision
index ddc17b20b78d2bacaba1fee53301ffb2a7955fec..c390b4cff15f60e3c7c12561c444c6f029cb8ef2 100644
--- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision
@@ -1 +1 @@
-260
\ No newline at end of file
+261
\ No newline at end of file
diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/template_catalog_method_id_list b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/template_catalog_method_id_list
index ceabc7ba3f155f6fb6fc0dbf10ca904502c88ba7..62b6bc91fade2cb5362a9b9b1a98f10bac2d2460 100644
--- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/template_catalog_method_id_list
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/template_catalog_method_id_list
@@ -3,6 +3,8 @@ erp5_mysql_innodb/SQLCatalog_catalogTransformationList
 erp5_mysql_innodb/SQLCatalog_makeFullTextQuery
 erp5_mysql_innodb/SQLCatalog_makeQuickSearchQuery
 erp5_mysql_innodb/SQLCatalog_makeSearchTextQuery
+erp5_mysql_innodb/SQLCatalog_makeTranslatedSimulationStateTitleSearchQuery
+erp5_mysql_innodb/SQLCatalog_zGetPossibleSimulationState
 erp5_mysql_innodb/z0_drop_alarm
 erp5_mysql_innodb/z0_drop_catalog
 erp5_mysql_innodb/z0_drop_category
diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/template_catalog_related_key_list b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/template_catalog_related_key_list
index f2a9ce29a8b7f64c241fd4df0ec377f942d31ae6..9aa4605a21f0fdb060b83cd4022f54d45bdbe5c1 100644
--- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/template_catalog_related_key_list
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/template_catalog_related_key_list
@@ -12,7 +12,7 @@ stock_payment_category_strict_membership_uid | category/category_uid/z_related_s
 stock_resource_category_strict_membership_uid | category/category_uid/z_related_strict_membership_resource_uid_from_stock
 translated_portal_type | translation/translated_message/z_related_translated_portal_type
 translated_simulation_state | translation/translated_message/z_related_translated_simulation_state
-translated_simulation_state_title | translation/translated_message/z_related_translated_simulation_state_title
+translated_simulation_state_title__ | translation/translated_message/z_related_translated_simulation_state_title
 translated_opportunity_state | translation/translated_message/z_related_translated_opportunity_state
 translated_opportunity_state_title | translation/translated_message/z_related_translated_opportunity_state_title
 career_skill_id | category,catalog,catalog/id/z_related_career_skill
diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/template_catalog_scriptable_key_list b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/template_catalog_scriptable_key_list
index c8f1e5bd64e31b6f023844022786d4af9f92767c..9f4b917b9121f91d3a406f9889664e0f981fc17d 100644
--- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/template_catalog_scriptable_key_list
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/template_catalog_scriptable_key_list
@@ -1,4 +1,5 @@
 quick_search_text | SQLCatalog_makeQuickSearchQuery
 advanced_search_text | SQLCatalog_makeQuickSearchQuery
 full_text | SQLCatalog_makeFullTextQuery
-search_text | SQLCatalog_makeSearchTextQuery
\ No newline at end of file
+search_text | SQLCatalog_makeSearchTextQuery
+translated_simulation_state_title | SQLCatalog_makeTranslatedSimulationStateTitleSearchQuery
\ No newline at end of file