You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2012/05/25 13:00:26 UTC

svn commit: r1342570 - in /subversion/trunk/subversion: libsvn_wc/wc-queries.sql tests/libsvn_wc/wc-queries-test.c

Author: rhuijben
Date: Fri May 25 11:00:26 2012
New Revision: 1342570

URL: http://svn.apache.org/viewvc?rev=1342570&view=rev
Log:
Rewrite a query to allow using indexes even though Sqlite doesn't understand
a thing of what the query tries to perform.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_SELECT_EXTERNAL_PROPERTIES): Rewrite using a UNION to allow using
    indexes for all cases.

* subversion/tests/libsvn_wc/wc-queries-test.c
  (slow_statements): And remove from the slow list.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1342570&r1=1342569&r2=1342570&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri May 25 11:00:26 2012
@@ -1011,17 +1011,33 @@ DELETE FROM externals
 WHERE wc_id = ?1 AND local_relpath = ?2
 
 -- STMT_SELECT_EXTERNAL_PROPERTIES
+/* ### It would be nice if Sqlite would handle
+ * SELECT IFNULL((SELECT properties FROM actual_node a
+ *                WHERE a.wc_id = ?1 AND A.local_relpath = n.local_relpath),
+ *               properties),
+ *        local_relpath, depth
+ * FROM nodes_current n
+ * WHERE wc_id = ?1
+ *   AND (local_relpath = ?2
+ *        OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+ *   AND kind = 'dir' AND presence IN ('normal', 'incomplete')
+ * ### But it would take a double table scan execution plan for it.
+ * ### Maybe there is something else going on? */
 SELECT IFNULL((SELECT properties FROM actual_node a
                WHERE a.wc_id = ?1 AND A.local_relpath = n.local_relpath),
               properties),
        local_relpath, depth
-FROM nodes n
-WHERE wc_id = ?1
-  AND (local_relpath = ?2
-       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
-  AND kind = 'dir' AND presence='normal'
-  AND op_depth=(SELECT MAX(op_depth) FROM nodes o
-                WHERE o.wc_id = ?1 AND o.local_relpath = n.local_relpath)
+FROM nodes_current n
+WHERE wc_id = ?1 AND local_relpath = ?2
+  AND kind = 'dir' AND presence IN ('normal', 'incomplete')
+UNION ALL
+SELECT IFNULL((SELECT properties FROM actual_node a
+               WHERE a.wc_id = ?1 AND A.local_relpath = n.local_relpath),
+              properties),
+       local_relpath, depth
+FROM nodes_current n
+WHERE wc_id = ?1 AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
+  AND kind = 'dir' AND presence IN ('normal', 'incomplete')
 
 /* ------------------------------------------------------------------------- */
 

Modified: subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c?rev=1342570&r1=1342569&r2=1342570&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c Fri May 25 11:00:26 2012
@@ -89,7 +89,6 @@ static const int slow_statements[] =
   STMT_HAS_WORKING_NODES,
 
   /* Need review: */
-  STMT_SELECT_EXTERNAL_PROPERTIES,
   STMT_DELETE_ACTUAL_EMPTIES,
 
   /* Upgrade statements? */