On Tue, May 31, 2011 at 7:03 AM, <julianfoad_at_apache.org> wrote:
> Author: julianfoad
> Date: Tue May 31 17:03:44 2011
> New Revision: 1129802
>
> URL: http://svn.apache.org/viewvc?rev=1129802&view=rev
> Log:
> * subversion/libsvn_wc/wc-checks.sql
> (validation_03, validation_04): Use more efficient SQL expressions.
I am in favor of the EXISTS statement, as I think it communicates our
intent better to the database, thus allowing it potentially better
optimize statements. It's also useful in communicating intent to
other developers. Are there other places we could use it?
-Hyrum
>
> Modified:
> subversion/trunk/subversion/libsvn_wc/wc-checks.sql
>
> Modified: subversion/trunk/subversion/libsvn_wc/wc-checks.sql
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-checks.sql?rev=1129802&r1=1129801&r2=1129802&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_wc/wc-checks.sql (original)
> +++ subversion/trunk/subversion/libsvn_wc/wc-checks.sql Tue May 31 17:03:44 2011
> @@ -56,7 +56,8 @@ WHEN NOT (
> OR
> ((SELECT COUNT(*) FROM nodes
> WHERE wc_id = new.wc_id AND op_depth = new.op_depth
> - AND local_relpath = new.parent_relpath) == 1)
> + AND local_relpath = new.parent_relpath
> + LIMIT 2) == 1)
> )
> BEGIN
> SELECT RAISE(FAIL, 'WC DB validity check 03 failed');
> @@ -66,9 +67,9 @@ END;
> * parent path. */
> CREATE TEMP TRIGGER validation_04 BEFORE INSERT ON actual_node
> WHEN NOT (new.local_relpath = ''
> - OR (SELECT COUNT(*) FROM nodes
> - WHERE wc_id = new.wc_id
> - AND local_relpath = new.parent_relpath) >= 1)
> + OR EXISTS (SELECT 1 FROM nodes
> + WHERE wc_id = new.wc_id
> + AND local_relpath = new.parent_relpath))
> BEGIN
> SELECT RAISE(FAIL, 'WC DB validity check 04 failed');
> END;
>
>
>
Received on 2011-05-31 19:17:52 CEST