Commit 4a2ce424 authored by Yusei Tahara's avatar Yusei Tahara Committed by Arnaud Fontaine

Replace a zsqlmethod for translated_simulation_state_title with python script...

Replace a zsqlmethod for translated_simulation_state_title with python script to add an extra condition to where expression. This helps m
ysql optimizer to make a better plan. Without it mysql optimizer may make a bad plan to join catalog and translation and causes bad performa
nce problem.
parent 9d6a8c4e
<?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>
<?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>
......@@ -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>
......
......@@ -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
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.
......
260
\ No newline at end of file
261
\ No newline at end of file
......@@ -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
......
......@@ -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
......
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment