Commit 3f6f07d1 authored by Mame Coumba Sall's avatar Mame Coumba Sall

Optimize methods by rewriting subqueries

parent 671a83f6
...@@ -86,7 +86,7 @@ FROM\n ...@@ -86,7 +86,7 @@ FROM\n
AND <dtml-var "query[\'where_expression\']">\n AND <dtml-var "query[\'where_expression\']">\n
</dtml-if>\n </dtml-if>\n
AND\n AND\n
MATCH(SearchableText) AGAINST(<dtml-sqlvar reference type=string>)\n MATCH(SearchableText) AGAINST(<dtml-let reference="\'%s\' % reference"><dtml-sqlvar reference type=string></dtml-let> IN BOOLEAN MODE)\n
AND\n AND\n
<dtml-sqltest reference op=ne type=string>\n <dtml-sqltest reference op=ne type=string>\n
ORDER BY reference, language_order DESC, version DESC, revision DESC\n ORDER BY reference, language_order DESC, version DESC, revision DESC\n
......
...@@ -64,8 +64,8 @@ SELECT path, uid\n ...@@ -64,8 +64,8 @@ SELECT path, uid\n
FROM\n FROM\n
(\n (\n
SELECT DISTINCT\n SELECT DISTINCT\n
path,\n sub.path,\n
(select uid from catalog where catalog.path=sub.path) as uid\n uid\n
FROM\n FROM\n
( SELECT\n ( SELECT\n
@current_path:=IF(@current_reference = reference, @current_path, path) AS path,\n @current_path:=IF(@current_reference = reference, @current_path, path) AS path,\n
...@@ -93,7 +93,7 @@ FROM\n ...@@ -93,7 +93,7 @@ FROM\n
ORDER BY reference, language_order DESC, version DESC, revision DESC\n ORDER BY reference, language_order DESC, version DESC, revision DESC\n
) AS innersub\n ) AS innersub\n
)\n )\n
AS sub\n AS sub inner join catalog on catalog.path = sub.path\n
)\n )\n
AS main\n AS main\n
WHERE\n WHERE\n
......
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